summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2023-02-27 22:39:29 +0000
committerLinus Groh <mail@linusgroh.de>2023-02-27 23:57:08 +0000
commitfb7aaeff3e3c8d19ed1876e87e884a891fe41478 (patch)
tree99e6122276ad66f62eb2db1a1b3206f9a2733e43
parentf4be95af692c2234299b60f63ec33ee6d5a36e95 (diff)
downloadserenity-fb7aaeff3e3c8d19ed1876e87e884a891fe41478.zip
LibJS/Bytecode: Return ThrowCompletionOr<void> from CreateVariable op
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Op.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp
index 7bbab0cb6b..2509670419 100644
--- a/Userland/Libraries/LibJS/Bytecode/Op.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp
@@ -449,19 +449,19 @@ ThrowCompletionOr<void> CreateVariable::execute_impl(Bytecode::Interpreter& inte
return vm.throw_completion<InternalError>(TRY_OR_THROW_OOM(vm, String::formatted("Lexical environment already has binding '{}'", name)));
if (m_is_immutable)
- vm.lexical_environment()->create_immutable_binding(vm, name, vm.in_strict_mode());
+ return vm.lexical_environment()->create_immutable_binding(vm, name, vm.in_strict_mode());
else
- vm.lexical_environment()->create_mutable_binding(vm, name, vm.in_strict_mode());
+ return vm.lexical_environment()->create_mutable_binding(vm, name, vm.in_strict_mode());
} else {
if (!m_is_global) {
if (m_is_immutable)
- vm.variable_environment()->create_immutable_binding(vm, name, vm.in_strict_mode());
+ return vm.variable_environment()->create_immutable_binding(vm, name, vm.in_strict_mode());
else
- vm.variable_environment()->create_mutable_binding(vm, name, vm.in_strict_mode());
+ return vm.variable_environment()->create_mutable_binding(vm, name, vm.in_strict_mode());
} else {
// NOTE: CreateVariable with m_is_global set to true is expected to only be used in GlobalDeclarationInstantiation currently, which only uses "false" for "can_be_deleted".
// The only area that sets "can_be_deleted" to true is EvalDeclarationInstantiation, which is currently fully implemented in C++ and not in Bytecode.
- verify_cast<GlobalEnvironment>(vm.variable_environment())->create_global_var_binding(name, false);
+ return verify_cast<GlobalEnvironment>(vm.variable_environment())->create_global_var_binding(name, false);
}
}
return {};