summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Parser.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-04-30 22:22:52 +0200
committerLinus Groh <mail@linusgroh.de>2022-05-01 22:47:38 +0200
commit5a26a547dbd3e0a05f0f8991876b254ba044103e (patch)
tree4e807a2f60a5651d415a0536a37233a12306a4f4 /Userland/Libraries/LibJS/Parser.cpp
parentce659e5eeba08989ff671e86a691ca83315bc722 (diff)
downloadserenity-5a26a547dbd3e0a05f0f8991876b254ba044103e.zip
LibJS: Update a couple of outdated spec comments
These are editorial changes in the ECMA-262 spec. See: - https://github.com/tc39/ecma262/commit/e080a7f - https://github.com/tc39/ecma262/commit/c5a9094 - https://github.com/tc39/ecma262/commit/5091520 - https://github.com/tc39/ecma262/commit/1c6564b - https://github.com/tc39/ecma262/commit/e06c80c
Diffstat (limited to 'Userland/Libraries/LibJS/Parser.cpp')
-rw-r--r--Userland/Libraries/LibJS/Parser.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Parser.cpp b/Userland/Libraries/LibJS/Parser.cpp
index 56bf3ca4a4..58329d7714 100644
--- a/Userland/Libraries/LibJS/Parser.cpp
+++ b/Userland/Libraries/LibJS/Parser.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@serenityos.org>
- * Copyright (c) 2020-2021, Linus Groh <linusg@serenityos.org>
+ * Copyright (c) 2020-2022, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2021-2022, David Tuin <davidot@serenityos.org>
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
@@ -3343,9 +3343,12 @@ NonnullRefPtr<IfStatement> Parser::parse_if_statement()
auto rule_start = push_start();
auto parse_function_declaration_as_block_statement = [&] {
// https://tc39.es/ecma262/#sec-functiondeclarations-in-ifstatement-statement-clauses
- // Code matching this production is processed as if each matching occurrence of
+ // This production only applies when parsing non-strict code. Source text matched
+ // by this production is processed as if each matching occurrence of
// FunctionDeclaration[?Yield, ?Await, ~Default] was the sole StatementListItem
- // of a BlockStatement occupying that position in the source code.
+ // of a BlockStatement occupying that position in the source text.
+ // The semantics of such a synthetic BlockStatement includes the web legacy
+ // compatibility semantics specified in B.3.2.
VERIFY(match(TokenType::Function));
auto block = create_ast_node<BlockStatement>({ m_state.current_token.filename(), rule_start.position(), position() });
ScopePusher block_scope = ScopePusher::block_scope(*this, *block);