Skip to content

Commit

Permalink
Use snek_code_prev_insn() instead of snek_compile_prev
Browse files Browse the repository at this point in the history
Be more consistent about using accessor functions.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Sep 16, 2021
1 parent 7a84b47 commit efd9884
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions snek-gram.ll
Expand Up @@ -38,7 +38,7 @@ command : @{ snek_print_val = snek_interactive; }@ stat
}@
OP opt-formals CP COLON suite
@{
if (snek_compile[snek_compile_prev] == snek_op_return)
if (snek_compile[snek_code_prev_insn()] == snek_op_return)
snek_code_delete_prev();
else
snek_code_add_op(snek_op_null);
Expand Down Expand Up @@ -215,7 +215,7 @@ if-expr : expr COLON
snek_code_add_op_offset(snek_op_branch_false, 0);

/* push 0 - if_expr_off */
value_push_offset(snek_compile_prev);
value_push_offset(snek_code_prev_insn());
}@
;
while-stat :
Expand All @@ -227,13 +227,13 @@ while-stat :
@{
snek_code_add_op_offset(snek_op_branch_false, 0);
/* push 1 - while_off */
value_push_offset(snek_compile_prev);
value_push_offset(snek_code_prev_insn());
}@
suite
@{
/* push 2 - loop_end_off */
snek_code_add_op_offset(snek_op_branch, 0);
value_push_offset(snek_compile_prev);
value_push_offset(snek_code_prev_insn());
/* push 3 - while_else_stat_off */
value_push_offset(snek_code_current());
}@
Expand All @@ -251,7 +251,7 @@ for-stat : FOR NAME
@{
snek_code_add_op_offset(snek_op_branch, 0);
/* push 2 - loop_end_off */
value_push_offset(snek_compile_prev);
value_push_offset(snek_code_prev_insn());
/* push 3 - while_else_stat_off */
value_push_offset(snek_code_current());
for_depth--;
Expand All @@ -268,9 +268,9 @@ for-params : RANGE OP opt-actuals CP COLON
snek_code_add_in_range(id, num, for_depth);
for_push_prevs:
/* push 0 - for_off */
value_push_offset(snek_compile_prev);
value_push_offset(snek_code_prev_insn());
/* push 1 - top_off */
value_push_offset(snek_compile_prev);
value_push_offset(snek_code_prev_insn());
for_depth++;
}@
| expr COLON
Expand Down

0 comments on commit efd9884

Please sign in to comment.