mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
plain->bytecode stack frame
This commit is contained in:
@@ -8,7 +8,7 @@ use super::bytecode_decoder::BytecodeType;
|
||||
use super::instruction::Instruction;
|
||||
use super::stack_frame_trait::{StackFrameTrait, FrameStepResult, CallResult};
|
||||
|
||||
pub struct PlainStackFrame {
|
||||
pub struct BytecodeStackFrame {
|
||||
pub decoder: BytecodeDecoder,
|
||||
pub registers: Vec<Val>,
|
||||
pub param_start: usize,
|
||||
@@ -17,7 +17,7 @@ pub struct PlainStackFrame {
|
||||
pub return_target: Option<usize>,
|
||||
}
|
||||
|
||||
impl PlainStackFrame {
|
||||
impl BytecodeStackFrame {
|
||||
pub fn apply_unary_op(
|
||||
&mut self,
|
||||
op: fn(input: Val) -> Val,
|
||||
@@ -84,7 +84,7 @@ impl PlainStackFrame {
|
||||
}
|
||||
}
|
||||
|
||||
impl StackFrameTrait for PlainStackFrame {
|
||||
impl StackFrameTrait for BytecodeStackFrame {
|
||||
fn write_this(&mut self, this: Val) {
|
||||
self.registers[1] = this;
|
||||
}
|
||||
@@ -429,7 +429,7 @@ impl StackFrameTrait for PlainStackFrame {
|
||||
}
|
||||
|
||||
fn get_call_result(&mut self) -> CallResult {
|
||||
std::panic!("Not appropriate for PlainStackFrame")
|
||||
std::panic!("Not appropriate for BytecodeStackFrame")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ mod native_function;
|
||||
mod builtins;
|
||||
mod math;
|
||||
mod vs_class;
|
||||
mod plain_stack_frame;
|
||||
mod bytecode_stack_frame;
|
||||
mod stack_frame_trait;
|
||||
mod first_stack_frame;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use super::vs_value::Val;
|
||||
use super::plain_stack_frame::PlainStackFrame;
|
||||
use super::bytecode_stack_frame::BytecodeStackFrame;
|
||||
use super::bytecode_decoder::BytecodeDecoder;
|
||||
use super::stack_frame_trait::StackFrameTrait;
|
||||
|
||||
@@ -44,7 +44,7 @@ impl VsFunction {
|
||||
registers.push(Val::Undefined);
|
||||
}
|
||||
|
||||
return Box::new(PlainStackFrame {
|
||||
return Box::new(BytecodeStackFrame {
|
||||
decoder: BytecodeDecoder {
|
||||
data: self.bytecode.clone(),
|
||||
pos: self.start,
|
||||
|
||||
Reference in New Issue
Block a user