Improve expected identifier checks. (#3064)
Checks for "of" or "from" does not accept quoted strings. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Robert Fancsik
parent
086c4ebf13
commit
96edec1a62
@@ -362,8 +362,7 @@ parser_module_parse_export_clause (parser_context_t *context_p) /**< parser cont
|
||||
uint16_t export_name_index = PARSER_MAXIMUM_NUMBER_OF_LITERALS;
|
||||
|
||||
lexer_next_token (context_p);
|
||||
if (context_p->token.type == LEXER_LITERAL
|
||||
&& lexer_compare_raw_identifier_to_current (context_p, "as", 2))
|
||||
if (lexer_compare_literal_to_identifier (context_p, "as", 2))
|
||||
{
|
||||
lexer_next_token (context_p);
|
||||
|
||||
@@ -415,8 +414,7 @@ parser_module_parse_export_clause (parser_context_t *context_p) /**< parser cont
|
||||
lexer_next_token (context_p);
|
||||
}
|
||||
|
||||
if (context_p->token.type == LEXER_LITERAL
|
||||
&& lexer_compare_raw_identifier_to_current (context_p, "from", 4))
|
||||
if (lexer_compare_literal_to_identifier (context_p, "from", 4))
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_EXPECTED);
|
||||
}
|
||||
@@ -455,8 +453,7 @@ parser_module_parse_import_clause (parser_context_t *context_p) /**< parser cont
|
||||
uint16_t local_name_index = PARSER_MAXIMUM_NUMBER_OF_LITERALS;
|
||||
|
||||
lexer_next_token (context_p);
|
||||
if (context_p->token.type == LEXER_LITERAL
|
||||
&& lexer_compare_raw_identifier_to_current (context_p, "as", 2))
|
||||
if (lexer_compare_literal_to_identifier (context_p, "as", 2))
|
||||
{
|
||||
lexer_next_token (context_p);
|
||||
|
||||
@@ -508,8 +505,7 @@ parser_module_parse_import_clause (parser_context_t *context_p) /**< parser cont
|
||||
lexer_next_token (context_p);
|
||||
}
|
||||
|
||||
if (context_p->token.type == LEXER_LITERAL
|
||||
&& lexer_compare_raw_identifier_to_current (context_p, "from", 4))
|
||||
if (lexer_compare_literal_to_identifier (context_p, "from", 4))
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_EXPECTED);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user