diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 854418f9e6..0d32dec26c 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -1381,7 +1381,7 @@ ThrowCompletionOr MemberExpression::to_reference(Interpreter& interpr property_key = static_cast(property()).string(); } - // 6. If the code matched by this SuperProperty is strict mode code, let strict be true; else let strict be false. + // 6. If the source text matched by this SuperProperty is strict mode code, let strict be true; else let strict be false. bool strict = interpreter.vm().in_strict_mode(); // 7. Return ? MakeSuperPropertyReference(actualThis, propertyKey, strict). 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 - * Copyright (c) 2020-2021, Linus Groh + * Copyright (c) 2020-2022, Linus Groh * Copyright (c) 2021-2022, David Tuin * Copyright (c) 2021, Ali Mohammad Pur * Copyright (c) 2021, Idan Horowitz @@ -3343,9 +3343,12 @@ NonnullRefPtr 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({ m_state.current_token.filename(), rule_start.position(), position() }); ScopePusher block_scope = ScopePusher::block_scope(*this, *block); diff --git a/Userland/Libraries/LibJS/Runtime/Array.cpp b/Userland/Libraries/LibJS/Runtime/Array.cpp index 0c3bdc3a04..19c825d8dc 100644 --- a/Userland/Libraries/LibJS/Runtime/Array.cpp +++ b/Userland/Libraries/LibJS/Runtime/Array.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Andreas Kling - * Copyright (c) 2020-2021, Linus Groh + * Copyright (c) 2020-2022, Linus Groh * * SPDX-License-Identifier: BSD-2-Clause */ @@ -82,7 +82,7 @@ ThrowCompletionOr Array::set_length(PropertyDescriptor const& property_des // 12. If oldLenDesc.[[Writable]] is false, return false. // NOTE: Handled by step 16 - // 13. If newLenDesc.[[Writable]] is absent or has the value true, let newWritable be true. + // 13. If newLenDesc.[[Writable]] is absent or is true, let newWritable be true. // 14. Else, // a. NOTE: Setting the [[Writable]] attribute to false is deferred in case any elements cannot be deleted. // b. Let newWritable be false. diff --git a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp index b4a7441e2a..12c2f03962 100644 --- a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp @@ -94,8 +94,7 @@ void DatePrototype::initialize(GlobalObject& global_object) define_native_function(vm.names.valueOf, get_time, 0, attr); // B.2.4.3 Date.prototype.toGMTString ( ), https://tc39.es/ecma262/#sec-date.prototype.togmtstring - // The function object that is the initial value of Date.prototype.toGMTString - // is the same function object that is the initial value of Date.prototype.toUTCString. + // The initial value of the "toGMTString" property is %Date.prototype.toUTCString%, defined in 21.4.4.43. define_direct_property(vm.names.toGMTString, get_without_side_effects(vm.names.toUTCString), attr); } diff --git a/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.cpp index be0763ebe4..51d376a00c 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionEnvironment.cpp @@ -32,7 +32,7 @@ ThrowCompletionOr FunctionEnvironment::get_super_base() const // 1. Let home be envRec.[[FunctionObject]].[[HomeObject]]. auto home_object = m_function_object->home_object(); - // 2. If home has the value undefined, return undefined. + // 2. If home is undefined, return undefined. if (!home_object) return js_undefined(); diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 841c0ae0dd..fe22680c69 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -582,7 +582,7 @@ ThrowCompletionOr VM::resolve_binding(FlyString const& name, Environm // 2. Assert: env is an Environment Record. VERIFY(environment); - // 3. If the code matching the syntactic production that is being evaluated is contained in strict mode code, let strict be true; else let strict be false. + // 3. If the source text matched by the syntactic production that is being evaluated is contained in strict mode code, let strict be true; else let strict be false. bool strict = in_strict_mode(); // 4. Return ? GetIdentifierReference(env, name, strict).