diff options
Diffstat (limited to 'Userland/Libraries/LibJS/Parser.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Parser.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Parser.cpp b/Userland/Libraries/LibJS/Parser.cpp index 06ee18cefc..7af6cd93e7 100644 --- a/Userland/Libraries/LibJS/Parser.cpp +++ b/Userland/Libraries/LibJS/Parser.cpp @@ -3174,6 +3174,9 @@ NonnullRefPtr<OptionalChain> Parser::parse_optional_chain(NonnullRefPtr<Expressi } else if (match(TokenType::Period)) { consume(); if (match(TokenType::PrivateIdentifier)) { + if (!is_private_identifier_valid()) + syntax_error(String::formatted("Reference to undeclared private field or method '{}'", m_state.current_token.value())); + auto start = position(); auto private_identifier = consume(); chain.append(OptionalChain::PrivateMemberReference { |