mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-01-15 00:18:06 -05:00
27 lines
603 B
Rust
27 lines
603 B
Rust
use super::vs_value::Val;
|
|
|
|
pub type StackFrame = Box<dyn StackFrameTrait>;
|
|
|
|
#[derive(Clone)]
|
|
pub struct CallResult {
|
|
pub return_: Val,
|
|
pub this: Val,
|
|
}
|
|
|
|
pub enum FrameStepOk {
|
|
Continue,
|
|
Pop(CallResult),
|
|
Push(StackFrame),
|
|
}
|
|
|
|
pub type FrameStepResult = Result<FrameStepOk, Val>;
|
|
|
|
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;
|
|
fn catch_exception(&mut self, exception: Val) -> bool;
|
|
}
|