Skip to content

Commit

Permalink
Add a method for clearing a cached index on a MAST::Frame
Browse files Browse the repository at this point in the history
When frames are written to multiple bytecode streams, they must not retain
their cached indexes as those won't be valid for all streams.
  • Loading branch information
niner committed Jun 7, 2020
1 parent 995c70c commit 6c7ee4e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/MAST/Nodes.nqp
Expand Up @@ -959,6 +959,11 @@ class MAST::Frame is MAST::Node {
}
}

method clear_index() {
$!frame_idx := -1;
$!flags := nqp::bitand_i($!flags, nqp::bitneg_i($FRAME_FLAG_HAS_INDEX));
}

method set_index(int $idx) {
$!frame_idx := $idx;
$!flags := nqp::bitor_i($!flags, $FRAME_FLAG_HAS_INDEX);
Expand Down

0 comments on commit 6c7ee4e

Please sign in to comment.