mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +00:00
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.
This commit is contained in:
committed by
Andreas Kling
parent
5407fe8fcf
commit
0e1943937c
@@ -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 {};
|
||||
|
||||
Reference in New Issue
Block a user