From 6fe78cc994b70c0254443a2ec48da7caabb6ed61 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Mon, 13 Jul 2015 21:22:16 +0300 Subject: [PATCH] Temporary workaround (until parser is refactored) for fixing evaluation of simple 'identifier'-like expressions. JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com --- jerry-core/parser/js/parser.cpp | 5 ++++- tests/unit/test-api.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jerry-core/parser/js/parser.cpp b/jerry-core/parser/js/parser.cpp index c445d7d87..24012e3b9 100644 --- a/jerry-core/parser/js/parser.cpp +++ b/jerry-core/parser/js/parser.cpp @@ -1756,6 +1756,8 @@ parse_expression (bool in_allowed, /**< flag indicating if 'in' is allowed insid skip_newlines (); if (token_is (TOK_COMMA)) { + dump_assignment_of_lhs_if_literal (expr); + skip_newlines (); expr = parse_assignment_expression (in_allowed); } @@ -2828,7 +2830,8 @@ parse_statement (jsp_label_t *outermost_stmt_label_p) /**< outermost (first) lab { lexer_save_token (tok); tok = temp; - parse_expression (true, JSP_EVAL_RET_STORE_DUMP); + operand expr = parse_expression (true, JSP_EVAL_RET_STORE_DUMP); + dump_assignment_of_lhs_if_literal (expr); skip_newlines (); if (!token_is (TOK_SEMICOLON)) { diff --git a/tests/unit/test-api.cpp b/tests/unit/test-api.cpp index 37c6c414a..0b1c85814 100644 --- a/tests/unit/test-api.cpp +++ b/tests/unit/test-api.cpp @@ -41,7 +41,7 @@ const char *test_source = ( " return this.external ('1', true); " "} " "function call_throw_test() { " - " bool catched = false " + " var catched = false " " try { " " this.throw_test(); " " } catch (e) { "