diff options
author | Linus Groh <mail@linusgroh.de> | 2022-05-24 18:19:49 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-05-25 00:25:23 +0100 |
commit | 89d409470997ec427781477fcfdab7c8b369a435 (patch) | |
tree | 7997139fee3ba78ea84482ea49b089fe0d0b5a15 /Userland | |
parent | cdc5ed2fb55b177b94e755c2824ac42715e04ec1 (diff) | |
download | serenity-89d409470997ec427781477fcfdab7c8b369a435.zip |
LibJS: Mark concrete method calls of Environment Records with ?/!
This is an editorial change in the ECMA-262 spec.
See: https://github.com/tc39/ecma262/commit/7ae3ecf
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/DeclarativeEnvironment.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/GlobalEnvironment.cpp | 11 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/SyntheticModule.cpp | 4 |
3 files changed, 8 insertions, 10 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironment.cpp index 4591d3e6c3..0f8e6f1862 100644 --- a/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironment.cpp +++ b/Userland/Libraries/LibJS/Runtime/DeclarativeEnvironment.cpp @@ -131,8 +131,7 @@ ThrowCompletionOr<void> DeclarativeEnvironment::set_mutable_binding(GlobalObject if (strict) return vm().throw_completion<ReferenceError>(global_object, ErrorType::UnknownIdentifier, name); - // FIXME: Should be `! envRec.CreateMutableBinding(N, true)` (see https://github.com/tc39/ecma262/pull/2764) - // b. Perform envRec.CreateMutableBinding(N, true). + // b. Perform ! envRec.CreateMutableBinding(N, true). MUST(create_mutable_binding(global_object, name, true)); // c. Perform ! envRec.InitializeBinding(N, V). diff --git a/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.cpp index d7f2f3d257..30015e0f6d 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.cpp +++ b/Userland/Libraries/LibJS/Runtime/GlobalEnvironment.cpp @@ -59,8 +59,8 @@ ThrowCompletionOr<void> GlobalEnvironment::create_mutable_binding(GlobalObject& if (MUST(m_declarative_record->has_binding(name))) return vm().throw_completion<TypeError>(global_object, ErrorType::GlobalEnvironmentAlreadyHasBinding, name); - // 3. Return DclRec.CreateMutableBinding(N, D). - return m_declarative_record->create_mutable_binding(global_object, name, can_be_deleted); + // 3. Return ! DclRec.CreateMutableBinding(N, D). + return MUST(m_declarative_record->create_mutable_binding(global_object, name, can_be_deleted)); } // 9.1.1.4.3 CreateImmutableBinding ( N, S ), https://tc39.es/ecma262/#sec-global-environment-records-createimmutablebinding-n-s @@ -71,8 +71,8 @@ ThrowCompletionOr<void> GlobalEnvironment::create_immutable_binding(GlobalObject if (MUST(m_declarative_record->has_binding(name))) return vm().throw_completion<TypeError>(global_object, ErrorType::GlobalEnvironmentAlreadyHasBinding, name); - // 3. Return DclRec.CreateImmutableBinding(N, S). - return m_declarative_record->create_immutable_binding(global_object, name, strict); + // 3. Return ! DclRec.CreateImmutableBinding(N, S). + return MUST(m_declarative_record->create_immutable_binding(global_object, name, strict)); } // 9.1.1.4.4 InitializeBinding ( N, V ), https://tc39.es/ecma262/#sec-global-environment-records-initializebinding-n-v @@ -112,8 +112,7 @@ ThrowCompletionOr<Value> GlobalEnvironment::get_binding_value(GlobalObject& glob // 1. Let DclRec be envRec.[[DeclarativeRecord]]. // 2. If ! DclRec.HasBinding(N) is true, then if (MUST(m_declarative_record->has_binding(name))) { - // FIXME: Should be `! DclRec.GetBindingValue(N, S)` (see https://github.com/tc39/ecma262/pull/2764) - // a. Return DclRec.GetBindingValue(N, S). + // a. Return ? DclRec.GetBindingValue(N, S). return m_declarative_record->get_binding_value(global_object, name, strict); } diff --git a/Userland/Libraries/LibJS/SyntheticModule.cpp b/Userland/Libraries/LibJS/SyntheticModule.cpp index bc64da9cee..5b5ed3f37f 100644 --- a/Userland/Libraries/LibJS/SyntheticModule.cpp +++ b/Userland/Libraries/LibJS/SyntheticModule.cpp @@ -61,10 +61,10 @@ ThrowCompletionOr<void> SyntheticModule::link(VM& vm) // 5. For each exportName in module.[[ExportNames]], for (auto& export_name : m_export_names) { // a. Perform ! envRec.CreateMutableBinding(exportName, false). - environment->create_mutable_binding(global_object, export_name, false); + MUST(environment->create_mutable_binding(global_object, export_name, false)); // b. Perform ! envRec.InitializeBinding(exportName, undefined). - environment->initialize_binding(global_object, export_name, js_undefined()); + MUST(environment->initialize_binding(global_object, export_name, js_undefined())); } // 6. Return unused. |