mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 12:52:44 +00:00 
			
		
		
		
	LibJS: Allow 'yield' as a variable name outside of generator functions
This commit is contained in:
		
							parent
							
								
									0292ad33eb
								
							
						
					
					
						commit
						bd9f28bba6
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -1680,6 +1680,10 @@ NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(bool for_l | |||
|                 consume(TokenType::Identifier).value()); | ||||
|         } else if (auto pattern = parse_binding_pattern()) { | ||||
|             target = pattern.release_nonnull(); | ||||
|         } else if (!m_state.in_generator_function_context && match(TokenType::Yield)) { | ||||
|             target = create_ast_node<Identifier>( | ||||
|                 { m_state.current_token.filename(), rule_start.position(), position() }, | ||||
|                 consume().value()); | ||||
|         } | ||||
| 
 | ||||
|         if (target.has<Empty>()) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ali Mohammad Pur
						Ali Mohammad Pur