Browse Source

Add missing environment creation in initial iteration of for loop (#3751)

pull/3762/head
raskad 8 months ago committed by GitHub
parent
commit
7987fd8c02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      core/engine/src/bytecompiler/statement/loop.rs

14
core/engine/src/bytecompiler/statement/loop.rs

@ -59,6 +59,20 @@ impl ByteCompiler<'_> {
} }
self.push_empty_loop_jump_control(use_expr); self.push_empty_loop_jump_control(use_expr);
if let Some((let_binding_indices, env_index)) = &let_binding_indices {
for index in let_binding_indices {
self.emit_with_varying_operand(Opcode::GetName, *index);
}
self.emit_opcode(Opcode::PopEnvironment);
self.emit_with_varying_operand(Opcode::PushDeclarativeEnvironment, *env_index);
for index in let_binding_indices.iter().rev() {
self.emit_with_varying_operand(Opcode::PutLexicalValue, *index);
}
}
let initial_jump = self.jump(); let initial_jump = self.jump();
let start_address = self.next_opcode_location(); let start_address = self.next_opcode_location();

Loading…
Cancel
Save