|
|
@ -2,7 +2,7 @@ use crate::{ |
|
|
|
builtins::{iterable::create_iter_result_object, Array}, |
|
|
|
builtins::{iterable::create_iter_result_object, Array}, |
|
|
|
js_str, |
|
|
|
js_str, |
|
|
|
vm::{opcode::Operation, CompletionType, GeneratorResumeKind}, |
|
|
|
vm::{opcode::Operation, CompletionType, GeneratorResumeKind}, |
|
|
|
Context, JsResult, |
|
|
|
Context, JsResult, JsValue, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/// `IteratorNext` implements the Opcode Operation for `Opcode::IteratorNext`
|
|
|
|
/// `IteratorNext` implements the Opcode Operation for `Opcode::IteratorNext`
|
|
|
@ -184,7 +184,12 @@ impl Operation for IteratorValueWithoutPop { |
|
|
|
.pop() |
|
|
|
.pop() |
|
|
|
.expect("iterator on the call frame must exist"); |
|
|
|
.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.frame_mut().iterators.push(iterator); |
|
|
|
|
|
|
|
|
|
|
|
context.vm.push(value?); |
|
|
|
context.vm.push(value?); |
|
|
|