diff options
author | Linus Groh <mail@linusgroh.de> | 2021-10-09 19:34:54 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-09 21:53:47 +0100 |
commit | 7652138ce009793055ce2d2e19847d509251dc38 (patch) | |
tree | edf96e2bd2fcb724004ab1fb615f1ceb0c72f62d /Userland/Libraries/LibJS/AST.cpp | |
parent | ae397541fb47f339f481246b46a9bfe60bfb43da (diff) | |
download | serenity-7652138ce009793055ce2d2e19847d509251dc38.zip |
LibJS: Convert set_mutable_binding() to ThrowCompletionOr
Also add spec step comments to it while we're here.
Diffstat (limited to 'Userland/Libraries/LibJS/AST.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/AST.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 18fbcd45b6..6fd525ecd1 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -166,9 +166,10 @@ Value FunctionDeclaration::execute(Interpreter& interpreter, GlobalObject& globa if (m_is_hoisted) { // Perform special annexB steps see step 3 of: https://tc39.es/ecma262/#sec-web-compat-functiondeclarationinstantiation - auto function_object = interpreter.vm().running_execution_context().lexical_environment->get_binding_value(global_object, name(), false); - interpreter.vm().running_execution_context().variable_environment->set_mutable_binding(global_object, name(), function_object, false); - VERIFY(!interpreter.exception()); + auto* variable_environment = interpreter.vm().running_execution_context().variable_environment; + auto* lexical_environment = interpreter.vm().running_execution_context().lexical_environment; + auto function_object = lexical_environment->get_binding_value(global_object, name(), false); + MUST(variable_environment->set_mutable_binding(global_object, name(), function_object, false)); } return {}; |