Skip to content

Commit

Permalink
Slightly shorter state mutation stanza
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Dec 7, 2020
1 parent 0e1b4f5 commit 108d39d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bril-ts/brili.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,14 @@ function evalFunc(func: bril.Function, state: State): Value | null {
if (!state.specparent) {
throw error(`abort in non-speculative state`);
}
state.env = state.specparent.env;
state.lastlabel = state.specparent.lastlabel;
state.curlabel = state.specparent.curlabel;
state.specparent = state.specparent.specparent;
// We do *not* restore `icount` from the saved state to ensure that we
// count "aborted" instructions.
Object.assign(state, {
env: state.specparent.env,
lastlabel: state.specparent.lastlabel,
curlabel: state.specparent.curlabel,
specparent: state.specparent.specparent,
});
break;
}
case 'next':
Expand Down

0 comments on commit 108d39d

Please sign in to comment.