bug fixes and performance improvements

This commit is contained in:
2023-05-07 22:35:38 +01:00
parent f3ce910f66
commit a604e40bad
167 changed files with 5965 additions and 4229 deletions

View File

@@ -0,0 +1,27 @@
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>,
}