mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-24 18:39:50 -04:00
MAINT: Cleanup up the InitThunk operation to use i32
This commit is contained in:
parent
996d8821d7
commit
673cb8f8b7
@ -109,8 +109,7 @@ pub enum Op {
|
|||||||
// Spacer operation, Does nothing.
|
// Spacer operation, Does nothing.
|
||||||
Noop,
|
Noop,
|
||||||
// Pending Computation
|
// Pending Computation
|
||||||
// TODO(jwall): This is unnecessary. Remove it.
|
InitThunk(i32), // Basically just used for module return expressions
|
||||||
InitThunk(usize),
|
|
||||||
Module(usize),
|
Module(usize),
|
||||||
Func(usize),
|
Func(usize),
|
||||||
Return,
|
Return,
|
||||||
@ -178,8 +177,7 @@ impl<'a> VM<'a> {
|
|||||||
Op::Cp => self.op_copy()?,
|
Op::Cp => self.op_copy()?,
|
||||||
//TODO(jwall): Should this take a user provided message?
|
//TODO(jwall): Should this take a user provided message?
|
||||||
Op::Bang => return dbg!(Err(Error {})),
|
Op::Bang => return dbg!(Err(Error {})),
|
||||||
// TODO(jwall): Remove this
|
Op::InitThunk(jp) => self.op_thunk(idx, *jp)?,
|
||||||
Op::InitThunk(jp) => self.op_thunk(idx, *jp as i32)?,
|
|
||||||
Op::Noop => {
|
Op::Noop => {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ use super::Op::{
|
|||||||
Val,
|
Val,
|
||||||
};
|
};
|
||||||
use super::Primitive::{Bool, Float, Int, Str};
|
use super::Primitive::{Bool, Float, Int, Str};
|
||||||
use super::Value::{C, P, T};
|
use super::Value::{C, P};
|
||||||
use super::VM;
|
use super::VM;
|
||||||
|
|
||||||
macro_rules! assert_cases {
|
macro_rules! assert_cases {
|
||||||
@ -407,13 +407,13 @@ fn test_select_short_circuit() {
|
|||||||
Sym("field".to_owned()), // 0 // search field
|
Sym("field".to_owned()), // 0 // search field
|
||||||
Sym("not_field".to_owned()), // 1 // first field to compare
|
Sym("not_field".to_owned()), // 1 // first field to compare
|
||||||
JumpIfNotEqual(2), // 2
|
JumpIfNotEqual(2), // 2
|
||||||
Val(Str("not our value".to_owned())), // 3
|
Val(Str("not our value".to_owned())), // 3 // expression for first field
|
||||||
Jump(4), // 4
|
Jump(4), // 4
|
||||||
Sym("field".to_owned()), // 5 // second field to compare
|
Sym("field".to_owned()), // 5 // second field to compare
|
||||||
JumpIfNotEqual(2), // 6
|
JumpIfNotEqual(2), // 6
|
||||||
Val(Int(1)), // 7
|
Val(Int(1)), // 7 // expression for second field
|
||||||
Jump(1), // 8
|
Jump(1), // 8
|
||||||
Bang, // 9
|
Bang, // 9 // default case
|
||||||
] => P(Int(1)),
|
] => P(Int(1)),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user