mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
Reorganize using workspaces
This commit is contained in:
23
valuescript_vm/src/stack_frame.rs
Normal file
23
valuescript_vm/src/stack_frame.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use super::vs_value::Val;
|
||||
|
||||
pub type StackFrame = Box<dyn StackFrameTrait>;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct CallResult {
|
||||
pub return_: Val,
|
||||
pub this: Val,
|
||||
}
|
||||
|
||||
pub enum FrameStepResult {
|
||||
Continue,
|
||||
Pop(CallResult),
|
||||
Push(StackFrame),
|
||||
}
|
||||
|
||||
pub trait StackFrameTrait {
|
||||
fn write_this(&mut self, this: Val);
|
||||
fn write_param(&mut self, param: Val);
|
||||
fn step(&mut self) -> FrameStepResult;
|
||||
fn apply_call_result(&mut self, call_result: CallResult);
|
||||
fn get_call_result(&mut self) -> CallResult;
|
||||
}
|
||||
Reference in New Issue
Block a user