mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-01-12 23:18:03 -05:00
Partially implement yield*
This commit is contained in:
@@ -560,7 +560,10 @@ impl StackFrameTrait for BytecodeStackFrame {
|
||||
}
|
||||
|
||||
YieldStar => {
|
||||
panic!("TODO: yield*");
|
||||
let val = self.decoder.decode_val(&self.registers);
|
||||
self.decoder.decode_register_index(); // TODO: Use this
|
||||
|
||||
return Ok(FrameStepOk::YieldStar(val));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -172,6 +172,7 @@ impl StackFrameTrait for GeneratorFrame {
|
||||
.to_dynamic_val(),
|
||||
this: take(&mut self.generator).to_dynamic_val(),
|
||||
})),
|
||||
Ok(FrameStepOk::YieldStar(_)) => panic!("TODO: yield* (as instruction)"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ pub enum FrameStepOk {
|
||||
Pop(CallResult),
|
||||
Push(StackFrame),
|
||||
Yield(Val),
|
||||
YieldStar(Val),
|
||||
}
|
||||
|
||||
pub type FrameStepResult = Result<FrameStepOk, Val>;
|
||||
|
||||
@@ -88,6 +88,7 @@ impl VirtualMachine {
|
||||
}
|
||||
// TODO: Internal errors
|
||||
FrameStepOk::Yield(_) => return self.handle_exception("Unexpected yield".to_error()),
|
||||
FrameStepOk::YieldStar(_) => return self.handle_exception("Unexpected yield*".to_error()),
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user