diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-04-05 03:54:58 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-04-05 11:46:48 +0200 |
commit | 0e1943937c0c0beb13e80bcb8a09a303d88319c0 (patch) | |
tree | 5940790b274ecfb4bd01bb6203bb5249e5683a60 /Userland | |
parent | 5407fe8fcf211e2bda737c141b12bd8cafe78835 (diff) | |
download | serenity-0e1943937c0c0beb13e80bcb8a09a303d88319c0.zip |
LibJS: Use InitializeOrSet to initialize function declarations in BC
A function may be redefined, in which case the existing binding is
expected to be reused.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index 249e53b99d..08abe4e5cc 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -54,7 +54,7 @@ Bytecode::CodeGenerationErrorOr<void> ScopeNode::generate_bytecode(Bytecode::Gen auto const& name = function_declaration.name(); auto index = generator.intern_identifier(name); generator.emit<Bytecode::Op::NewFunction>(function_declaration); - generator.emit<Bytecode::Op::SetVariable>(index, Bytecode::Op::SetVariable::InitializationMode::Initialize); + generator.emit<Bytecode::Op::SetVariable>(index, Bytecode::Op::SetVariable::InitializationMode::InitializeOrSet); } return {}; |