Converted Interner to work with Rc-s

- Interner no longer contains unsafe code
- Tokens now hold a reference to the value they represent directly

This will enable many future improvements
This commit is contained in:
2023-08-19 14:03:05 +01:00
parent ab0b57b1b8
commit 0b887ced70
62 changed files with 592 additions and 762 deletions

View File

@@ -30,8 +30,9 @@ pub fn run(expr: ExprInst, mut ctx: Context) -> Result<Return, RuntimeError> {
i = clause.clone();
},
Clause::Constant(c) => {
let symval = (ctx.symbols.get(c))
.ok_or_else(|| RuntimeError::MissingSymbol(*c, loc.clone()))?;
let symval = (ctx.symbols.get(c)).ok_or_else(|| {
RuntimeError::MissingSymbol(c.clone(), loc.clone())
})?;
ctx.gas = ctx.gas.map(|g| g - 1); // cost of lookup
i = symval.expr().clause.clone();
},