add inc field to Inc instruction

This commit is contained in:
Folkert 2021-01-22 00:16:20 +01:00
parent 5a2b2cbcac
commit 15cbadf652
6 changed files with 21 additions and 14 deletions

View file

@ -52,7 +52,7 @@ pub fn occuring_variables(stmt: &Stmt<'_>) -> (MutSet<Symbol>, MutSet<Symbol>) {
Rethrow => {}
Inc(symbol, cont) | Dec(symbol, cont) => {
Inc(symbol, _, cont) | Dec(symbol, cont) => {
result.insert(*symbol);
stack.push(cont);
}
@ -275,7 +275,7 @@ impl<'a> Context<'a> {
return stmt;
}
self.arena.alloc(Stmt::Inc(symbol, stmt))
self.arena.alloc(Stmt::Inc(symbol, 1, stmt))
}
fn add_dec(&self, symbol: Symbol, stmt: &'a Stmt<'a>) -> &'a Stmt<'a> {
@ -851,7 +851,7 @@ impl<'a> Context<'a> {
(switch, case_live_vars)
}
RuntimeError(_) | Inc(_, _) | Dec(_, _) => (stmt, MutSet::default()),
RuntimeError(_) | Inc(_, _, _) | Dec(_, _) => (stmt, MutSet::default()),
}
}
}
@ -902,7 +902,7 @@ pub fn collect_stmt(
vars
}
Inc(symbol, cont) | Dec(symbol, cont) => {
Inc(symbol, _, cont) | Dec(symbol, cont) => {
vars.insert(*symbol);
collect_stmt(cont, jp_live_vars, vars)
}