Fix insert_semicolon
This commit is contained in:
+10
-8
@@ -889,13 +889,6 @@ lexer_next_token_private (void)
|
||||
{
|
||||
char c = LA (0);
|
||||
|
||||
if (!is_empty (saved_token))
|
||||
{
|
||||
token res = saved_token;
|
||||
saved_token = empty_token;
|
||||
return res;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (token_start == NULL);
|
||||
|
||||
if (__isalpha (c) || c == '$' || c == '_')
|
||||
@@ -1043,20 +1036,29 @@ lexer_next_token (void)
|
||||
dump_current_line ();
|
||||
}
|
||||
|
||||
if (!is_empty (saved_token))
|
||||
{
|
||||
sent_token = saved_token;
|
||||
saved_token = empty_token;
|
||||
goto end;
|
||||
}
|
||||
|
||||
prev_token = sent_token;
|
||||
sent_token = lexer_next_token_private ();
|
||||
|
||||
if (sent_token.type == TOK_NEWLINE)
|
||||
{
|
||||
dump_current_line ();
|
||||
return sent_token;
|
||||
}
|
||||
|
||||
end:
|
||||
return sent_token;
|
||||
}
|
||||
|
||||
void
|
||||
lexer_save_token (token tok)
|
||||
{
|
||||
JERRY_ASSERT (is_empty (saved_token));
|
||||
saved_token = tok;
|
||||
}
|
||||
|
||||
|
||||
@@ -1132,7 +1132,7 @@ parse_function_expression (void)
|
||||
parse_source_element_list (false);
|
||||
pop_nesting (NESTING_FUNCTION);
|
||||
|
||||
token_after_newlines_must_be (TOK_CLOSE_BRACE);
|
||||
next_token_must_be (TOK_CLOSE_BRACE);
|
||||
|
||||
DUMP_VOID_OPCODE (ret);
|
||||
rewrite_meta_opcode_counter (STACK_TOP (U16), OPCODE_META_TYPE_FUNCTION_END);
|
||||
@@ -3001,8 +3001,9 @@ insert_semicolon (void)
|
||||
{
|
||||
// We cannot use TOK (), since we may use lexer_save_token
|
||||
skip_token ();
|
||||
if (lexer_prev_token ().type == TOK_NEWLINE)
|
||||
if (token_is (TOK_NEWLINE) || lexer_prev_token ().type == TOK_NEWLINE)
|
||||
{
|
||||
lexer_save_token (TOK ());
|
||||
return;
|
||||
}
|
||||
if (!token_is (TOK_SEMICOLON))
|
||||
|
||||
Reference in New Issue
Block a user