Skip to content

Commit

Permalink
Fix class constructor return value (#3028)
Browse files Browse the repository at this point in the history
  • Loading branch information
raskad authored and Razican committed Jun 26, 2023
1 parent c761058 commit 1a0590e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion boa_engine/src/bytecompiler/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ impl ByteCompiler<'_, '_> {
} else {
compiler.code_block_flags |= CodeBlockFlags::IS_CLASS_CONSTRUCTOR;
}

compiler.emit_opcode(Opcode::PushUndefined);
} else {
if class.super_ref().is_some() {
compiler.emit_opcode(Opcode::SuperCallDerived);
} else {
compiler.emit_opcode(Opcode::RestParameterPop);
compiler.emit_opcode(Opcode::PushUndefined);
}
compiler.pop_compile_environment();
compiler.code_block_flags |= CodeBlockFlags::IS_CLASS_CONSTRUCTOR;
Expand All @@ -69,7 +74,6 @@ impl ByteCompiler<'_, '_> {
compiler.pop_compile_environment();
}

compiler.emit_opcode(Opcode::PushUndefined);
compiler.emit_opcode(Opcode::Return);

let code = Gc::new(compiler.finish());
Expand Down

0 comments on commit 1a0590e

Please sign in to comment.