mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:57:35 +00:00
LibJS/Bytecode: Return ThrowCompletionOr<void> from CreateVariable op
This commit is contained in:
parent
f4be95af69
commit
fb7aaeff3e
1 changed files with 5 additions and 5 deletions
|
@ -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)));
|
return vm.throw_completion<InternalError>(TRY_OR_THROW_OOM(vm, String::formatted("Lexical environment already has binding '{}'", name)));
|
||||||
|
|
||||||
if (m_is_immutable)
|
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
|
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 {
|
} else {
|
||||||
if (!m_is_global) {
|
if (!m_is_global) {
|
||||||
if (m_is_immutable)
|
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
|
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 {
|
} 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".
|
// 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.
|
// 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 {};
|
return {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue