mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibJS: Add support for the '#privateName in obj' expression
This commit is contained in:
parent
16cc82460f
commit
7e8724db71
2 changed files with 23 additions and 0 deletions
|
@ -1214,6 +1214,11 @@ Parser::PrimaryExpressionParseResult Parser::parse_primary_expression()
|
|||
if (!m_state.in_generator_function_context)
|
||||
goto read_as_identifier;
|
||||
return { parse_yield_expression(), false };
|
||||
case TokenType::PrivateIdentifier:
|
||||
VERIFY(next_token().type() == TokenType::In);
|
||||
if (!is_private_identifier_valid())
|
||||
syntax_error(String::formatted("Reference to undeclared private field or method '{}'", m_state.current_token.value()));
|
||||
return { create_ast_node<PrivateIdentifier>({ m_state.current_token.filename(), rule_start.position(), position() }, consume().value()) };
|
||||
default:
|
||||
if (match_identifier_name())
|
||||
goto read_as_identifier;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue