|
|
@ -312,7 +312,8 @@ impl ByteCompiler<'_> { |
|
|
|
self.emit_with_varying_operand(Opcode::PushDeclarativeEnvironment, env_index); |
|
|
|
self.emit_with_varying_operand(Opcode::PushDeclarativeEnvironment, env_index); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
let mut handler_index = None; |
|
|
|
let handler_index = self.push_handler(); |
|
|
|
|
|
|
|
|
|
|
|
match for_of_loop.initializer() { |
|
|
|
match for_of_loop.initializer() { |
|
|
|
IterableLoopInitializer::Identifier(ref ident) => { |
|
|
|
IterableLoopInitializer::Identifier(ref ident) => { |
|
|
|
let ident = ident.to_js_string(self.interner()); |
|
|
|
let ident = ident.to_js_string(self.interner()); |
|
|
@ -331,7 +332,6 @@ impl ByteCompiler<'_> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
IterableLoopInitializer::Access(access) => { |
|
|
|
IterableLoopInitializer::Access(access) => { |
|
|
|
handler_index = Some(self.push_handler()); |
|
|
|
|
|
|
|
self.access_set( |
|
|
|
self.access_set( |
|
|
|
Access::Property { access }, |
|
|
|
Access::Property { access }, |
|
|
|
false, |
|
|
|
false, |
|
|
@ -384,15 +384,13 @@ impl ByteCompiler<'_> { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
IterableLoopInitializer::Pattern(pattern) => { |
|
|
|
IterableLoopInitializer::Pattern(pattern) => { |
|
|
|
handler_index = Some(self.push_handler()); |
|
|
|
|
|
|
|
self.compile_declaration_pattern(pattern, BindingOpcode::SetName); |
|
|
|
self.compile_declaration_pattern(pattern, BindingOpcode::SetName); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// If the left-hand side is not a lexical binding and the assignment produces
|
|
|
|
self.compile_stmt(for_of_loop.body(), use_expr, true); |
|
|
|
// an error, the iterator should be closed and the error forwarded to the
|
|
|
|
|
|
|
|
// runtime.
|
|
|
|
{ |
|
|
|
if let Some(handler_index) = handler_index { |
|
|
|
|
|
|
|
let exit = self.jump(); |
|
|
|
let exit = self.jump(); |
|
|
|
self.patch_handler(handler_index); |
|
|
|
self.patch_handler(handler_index); |
|
|
|
|
|
|
|
|
|
|
@ -411,8 +409,6 @@ impl ByteCompiler<'_> { |
|
|
|
self.patch_jump(exit); |
|
|
|
self.patch_jump(exit); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
self.compile_stmt(for_of_loop.body(), use_expr, true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(old_lex_env) = old_lex_env { |
|
|
|
if let Some(old_lex_env) = old_lex_env { |
|
|
|
self.pop_compile_environment(); |
|
|
|
self.pop_compile_environment(); |
|
|
|
self.lexical_environment = old_lex_env; |
|
|
|
self.lexical_environment = old_lex_env; |
|
|
|