plain->bytecode stack frame

This commit is contained in:
Andrew Morris
2022-05-30 09:32:52 +10:00
parent 97e39df07d
commit ae64a31bb4
3 changed files with 7 additions and 7 deletions

View File

@@ -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")
}
}

View File

@@ -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;

View File

@@ -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,