- inertness now tracked separately from gas - atomic_impl now correctly rolls over when the argument is inert - syntax fixes - tree shaking
29 lines
658 B
Rust
29 lines
658 B
Rust
use hashbrown::HashMap;
|
|
|
|
use crate::representations::interpreted::ExprInst;
|
|
use crate::interner::Token;
|
|
|
|
#[derive(Clone)]
|
|
pub struct Context<'a> {
|
|
pub symbols: &'a HashMap<Token<Vec<Token<String>>>, ExprInst>,
|
|
pub gas: Option<usize>,
|
|
}
|
|
|
|
impl Context<'_> {
|
|
pub fn is_stuck(&self, res: Option<usize>) -> bool {
|
|
match (res, self.gas) {
|
|
(Some(a), Some(b)) => a == b,
|
|
(None, None) => false,
|
|
(None, Some(_)) => panic!("gas not tracked despite limit"),
|
|
(Some(_), None) => panic!("gas tracked without request"),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct Return {
|
|
pub state: ExprInst,
|
|
pub gas: Option<usize>,
|
|
pub inert: bool,
|
|
}
|