mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
Generators make regular calls and regular returns
This commit is contained in:
@@ -31,3 +31,41 @@ impl Clone for StackFrame {
|
||||
self.clone_to_stack_frame()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for StackFrame {
|
||||
fn default() -> Self {
|
||||
Box::new(VoidStackFrame {})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct VoidStackFrame {}
|
||||
|
||||
impl StackFrameTrait for VoidStackFrame {
|
||||
fn write_this(&mut self, _const: bool, _this: Val) -> Result<(), Val> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_param(&mut self, _param: Val) {}
|
||||
|
||||
fn step(&mut self) -> FrameStepResult {
|
||||
Ok(FrameStepOk::Continue)
|
||||
}
|
||||
|
||||
fn apply_call_result(&mut self, _call_result: CallResult) {}
|
||||
|
||||
fn get_call_result(&mut self) -> CallResult {
|
||||
CallResult {
|
||||
return_: Val::Void,
|
||||
this: Val::Void,
|
||||
}
|
||||
}
|
||||
|
||||
fn catch_exception(&mut self, _exception: Val) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn clone_to_stack_frame(&self) -> StackFrame {
|
||||
Box::new(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user