Skip to content

Commit

Permalink
Add missing class name binding (#3328)
Browse files Browse the repository at this point in the history
  • Loading branch information
raskad authored Oct 1, 2023
1 parent ca37aa2 commit 8fd4744
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions boa_engine/src/bytecompiler/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@ impl ByteCompiler<'_, '_> {
self.emit_opcode(Opcode::Pop);

if let Some(class_env) = class_env {
self.emit_opcode(Opcode::Dup);
self.emit_binding(BindingOpcode::InitConst, class_name.into());

let env_index = self.pop_compile_environment();
self.patch_jump_with_target(class_env, env_index);
self.emit_opcode(Opcode::PopEnvironment);
Expand All @@ -603,10 +606,7 @@ impl ByteCompiler<'_, '_> {
self.emit_opcode(Opcode::PopPrivateEnvironment);

if !expression {
self.emit_binding(
BindingOpcode::InitVar,
class.name().expect("class statements must have a name"),
);
self.emit_binding(BindingOpcode::InitVar, class_name.into());
}
}
}

0 comments on commit 8fd4744

Please sign in to comment.