compile: Make sure the matcher is not overridden in nested assignments
This commit is contained in:
parent
d731fa828a
commit
19a5191e59
1 changed files with 12 additions and 2 deletions
|
|
@ -533,6 +533,18 @@ compile_complex_assignment(
|
|||
struct apfl_position position,
|
||||
struct instruction_list *ilist
|
||||
) {
|
||||
// TODO: This is not entirely correct: By evaluating the RHS first, it might
|
||||
// affect variables used in the matcher. This is only really important when
|
||||
// predicates are used, which are not yet implemented:
|
||||
//
|
||||
// x = {true}
|
||||
// foo?x = ({x={false}})
|
||||
//
|
||||
// This should succeed: The predicate x should be loaded before the
|
||||
// evaluation of the rhs occurs. With our current implementation it will
|
||||
// fail, though.
|
||||
TRY(compile_expr(compiler, assignment->rhs, ilist));
|
||||
|
||||
TRY(ilist_ensure_cap(compiler, ilist, 2));
|
||||
|
||||
struct matcher_instruction_list *milist;
|
||||
|
|
@ -555,8 +567,6 @@ compile_complex_assignment(
|
|||
|
||||
TRY(concat_ilists(compiler, ilist, ilists.newvars));
|
||||
|
||||
TRY(compile_expr(compiler, assignment->rhs, ilist));
|
||||
|
||||
TRY(ilist_ensure_cap(compiler, ilist, 1));
|
||||
ilist_put_insn(ilist, INSN_MATCHER_MUST_MATCH);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue