mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
LibJS: Allow 'yield' as a variable name outside of generator functions
This commit is contained in:
committed by
Andreas Kling
parent
0292ad33eb
commit
bd9f28bba6
@@ -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>()) {
|
||||
|
||||
Reference in New Issue
Block a user