Fix checking of semicolons in expression statements.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
This commit is contained in:
committed by
Evgeny Gavrin
parent
0e8cb596d7
commit
4f58104981
@@ -2561,7 +2561,7 @@ insert_semicolon (void)
|
|||||||
{
|
{
|
||||||
lexer_save_token (tok);
|
lexer_save_token (tok);
|
||||||
}
|
}
|
||||||
else if (!token_is (TOK_SEMICOLON))
|
else if (!token_is (TOK_SEMICOLON) && !token_is (TOK_EOF))
|
||||||
{
|
{
|
||||||
EMIT_ERROR ("Expected either ';' or newline token");
|
EMIT_ERROR ("Expected either ';' or newline token");
|
||||||
}
|
}
|
||||||
@@ -2847,23 +2847,13 @@ parse_statement (jsp_label_t *outermost_stmt_label_p) /**< outermost (first) lab
|
|||||||
tok = temp;
|
tok = temp;
|
||||||
operand expr = 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);
|
dump_assignment_of_lhs_if_literal (expr);
|
||||||
skip_newlines ();
|
insert_semicolon ();
|
||||||
if (!token_is (TOK_SEMICOLON))
|
|
||||||
{
|
|
||||||
lexer_save_token (tok);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parse_expression (true, JSP_EVAL_RET_STORE_DUMP);
|
parse_expression (true, JSP_EVAL_RET_STORE_DUMP);
|
||||||
skip_newlines ();
|
insert_semicolon ();
|
||||||
if (!token_is (TOK_SEMICOLON))
|
|
||||||
{
|
|
||||||
lexer_save_token (tok);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ const char *test_source = (
|
|||||||
"this.foo = f; "
|
"this.foo = f; "
|
||||||
"this.bar = function (a) { "
|
"this.bar = function (a) { "
|
||||||
"return a + t; "
|
"return a + t; "
|
||||||
"} "
|
"}; "
|
||||||
"function A () { "
|
"function A () { "
|
||||||
"this.t = 12; "
|
"this.t = 12; "
|
||||||
"} "
|
"} "
|
||||||
|
|||||||
Reference in New Issue
Block a user