summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Parser.h
diff options
context:
space:
mode:
authordavidot <david.tuin@gmail.com>2021-07-29 02:03:16 +0200
committerLinus Groh <mail@linusgroh.de>2021-08-16 23:20:04 +0100
commit5f344f7ca3158aa6c5c2e95e95e3f4a58a76dc00 (patch)
tree607ddddadec686737b676a37478bbec1cda544c0 /Userland/Libraries/LibJS/Parser.h
parent179c48e1a44a6eda9e409d4087bca265cf28bd42 (diff)
downloadserenity-5f344f7ca3158aa6c5c2e95e95e3f4a58a76dc00.zip
LibJS: Check that 'let' is followed by declaration before matching it
Since 'let' is a valid variable name (in non-strict mode) let may not be the start of a declaration but just an identifier.
Diffstat (limited to 'Userland/Libraries/LibJS/Parser.h')
-rw-r--r--Userland/Libraries/LibJS/Parser.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Parser.h b/Userland/Libraries/LibJS/Parser.h
index 97036c8de6..eaf9df0a94 100644
--- a/Userland/Libraries/LibJS/Parser.h
+++ b/Userland/Libraries/LibJS/Parser.h
@@ -159,8 +159,9 @@ private:
bool match_secondary_expression(const Vector<TokenType>& forbidden = {}) const;
bool match_statement() const;
bool match_export_or_import() const;
- bool match_declaration() const;
- bool match_variable_declaration() const;
+ bool match_declaration();
+ bool try_match_let_declaration();
+ bool match_variable_declaration();
bool match_identifier() const;
bool match_identifier_name() const;
bool match_property_key() const;