@@ -182,65 +182,78 @@ scanner_check_arrow_arg (parser_context_t *context_p, /**< context */
182182 lexer_next_token (context_p );
183183 }
184184
185- if (context_p -> token .type == LEXER_LITERAL
186- && context_p -> token .lit_location .type == LEXER_IDENT_LITERAL )
185+ switch (context_p -> token .type )
187186 {
188- scanner_context_p -> mode = SCAN_MODE_POST_PRIMARY_EXPRESSION ;
189-
190- if (lexer_check_arrow (context_p ))
187+ case LEXER_RIGHT_PAREN :
191188 {
192- process_arrow = true;
189+ scanner_context_p -> mode = SCAN_MODE_PRIMARY_EXPRESSION_END ;
190+ return ;
193191 }
194- else
192+ case LEXER_LITERAL :
195193 {
194+ if (context_p -> token .lit_location .type != LEXER_IDENT_LITERAL )
195+ {
196+ break ;
197+ }
198+
199+ scanner_context_p -> mode = SCAN_MODE_POST_PRIMARY_EXPRESSION ;
200+
201+ if (lexer_check_arrow (context_p ))
202+ {
203+ process_arrow = true;
204+ break ;
205+ }
206+
196207 lexer_lit_location_t * argument_literal_p = scanner_append_argument (context_p , scanner_context_p );
197208
198209 scanner_detect_eval_call (context_p , scanner_context_p );
199210
200211 lexer_next_token (context_p );
201212
202- if (context_p -> token .type == LEXER_ASSIGN )
213+ if (context_p -> token .type == LEXER_COMMA || context_p -> token . type == LEXER_RIGHT_PAREN )
203214 {
204- if (argument_literal_p -> type & SCANNER_LITERAL_IS_USED )
205- {
206- JERRY_ASSERT (argument_literal_p -> type & SCANNER_LITERAL_EARLY_CREATE );
207- return ;
208- }
215+ return ;
216+ }
209217
210- scanner_binding_literal_t binding_literal ;
211- binding_literal .literal_p = argument_literal_p ;
218+ if (context_p -> token .type != LEXER_ASSIGN )
219+ {
220+ break ;
221+ }
212222
213- parser_stack_push (context_p , & binding_literal , sizeof (scanner_binding_literal_t ));
214- parser_stack_push_uint8 (context_p , SCAN_STACK_BINDING_INIT );
223+ if (argument_literal_p -> type & SCANNER_LITERAL_IS_USED )
224+ {
225+ JERRY_ASSERT (argument_literal_p -> type & SCANNER_LITERAL_EARLY_CREATE );
215226 return ;
216227 }
217228
218- if (context_p -> token .type == LEXER_COMMA || context_p -> token .type == LEXER_RIGHT_PAREN )
229+ scanner_binding_literal_t binding_literal ;
230+ binding_literal .literal_p = argument_literal_p ;
231+
232+ parser_stack_push (context_p , & binding_literal , sizeof (scanner_binding_literal_t ));
233+ parser_stack_push_uint8 (context_p , SCAN_STACK_BINDING_INIT );
234+ return ;
235+ }
236+ case LEXER_LEFT_SQUARE :
237+ case LEXER_LEFT_BRACE :
238+ {
239+ scanner_append_hole (context_p , scanner_context_p );
240+ scanner_push_destructuring_pattern (context_p , scanner_context_p , SCANNER_BINDING_ARROW_ARG , false);
241+
242+ if (context_p -> token .type == LEXER_LEFT_BRACE )
219243 {
244+ parser_stack_push_uint8 (context_p , SCAN_STACK_OBJECT_LITERAL );
245+ scanner_context_p -> mode = SCAN_MODE_PROPERTY_NAME ;
220246 return ;
221247 }
222- }
223- }
224- else if (context_p -> token .type == LEXER_LEFT_SQUARE || context_p -> token .type == LEXER_LEFT_BRACE )
225- {
226- scanner_append_hole (context_p , scanner_context_p );
227- scanner_push_destructuring_pattern (context_p , scanner_context_p , SCANNER_BINDING_ARROW_ARG , false);
228248
229- if (context_p -> token .type == LEXER_LEFT_BRACE )
230- {
231- parser_stack_push_uint8 (context_p , SCAN_STACK_OBJECT_LITERAL );
232- scanner_context_p -> mode = SCAN_MODE_PROPERTY_NAME ;
249+ parser_stack_push_uint8 (context_p , SCAN_STACK_ARRAY_LITERAL );
250+ scanner_context_p -> mode = SCAN_MODE_BINDING ;
251+ lexer_next_token (context_p );
233252 return ;
234253 }
235-
236- parser_stack_push_uint8 (context_p , SCAN_STACK_ARRAY_LITERAL );
237- scanner_context_p -> mode = SCAN_MODE_BINDING ;
238- lexer_next_token (context_p );
239- return ;
240254 }
241255
242256 scanner_pop_literal_pool (context_p , scanner_context_p );
243-
244257 parser_stack_pop_uint8 (context_p );
245258
246259 if (context_p -> stack_top_uint8 == SCAN_STACK_USE_ASYNC )
0 commit comments