diff --git a/core/engine/src/bytecompiler/declaration/declaration_pattern.rs b/core/engine/src/bytecompiler/declaration/declaration_pattern.rs index efde60a13d..254627d173 100644 --- a/core/engine/src/bytecompiler/declaration/declaration_pattern.rs +++ b/core/engine/src/bytecompiler/declaration/declaration_pattern.rs @@ -119,6 +119,7 @@ impl ByteCompiler<'_> { self.emit_opcode(Opcode::Dup); if let PropertyName::Computed(node) = &name { self.compile_expr(node, true); + self.emit_opcode(Opcode::ToPropertyKey); self.emit_opcode(Opcode::Swap); } diff --git a/core/engine/src/bytecompiler/declarations.rs b/core/engine/src/bytecompiler/declarations.rs index 941e349f44..d5616fbf00 100644 --- a/core/engine/src/bytecompiler/declarations.rs +++ b/core/engine/src/bytecompiler/declarations.rs @@ -587,7 +587,7 @@ impl ByteCompiler<'_> { .r#async(r#async) .strict(self.strict()) .in_with(self.in_with) - .binding_identifier(Some(name.sym().to_js_string(self.interner()))) + .binding_identifier(None) .compile( parameters, body, diff --git a/core/engine/src/vm/opcode/iteration/iterator.rs b/core/engine/src/vm/opcode/iteration/iterator.rs index c43afd192d..c101987135 100644 --- a/core/engine/src/vm/opcode/iteration/iterator.rs +++ b/core/engine/src/vm/opcode/iteration/iterator.rs @@ -2,7 +2,7 @@ use crate::{ builtins::{iterable::create_iter_result_object, Array}, js_str, vm::{opcode::Operation, CompletionType, GeneratorResumeKind}, - Context, JsResult, + Context, JsResult, JsValue, }; /// `IteratorNext` implements the Opcode Operation for `Opcode::IteratorNext` @@ -184,7 +184,12 @@ impl Operation for IteratorValueWithoutPop { .pop() .expect("iterator on the call frame must exist"); - let value = iterator.value(context); + let value = if iterator.done() { + Ok(JsValue::undefined()) + } else { + iterator.value(context) + }; + context.vm.frame_mut().iterators.push(iterator); context.vm.push(value?);