fix: lazy operators incorrectly pop values from stack
This commit is contained in:
parent
af31b1ab79
commit
26591d6631
@ -29,7 +29,7 @@ public class LazyAndStatement extends Statement {
|
|||||||
if (pollute) target.add(Instruction.dup().locate(loc()));
|
if (pollute) target.add(Instruction.dup().locate(loc()));
|
||||||
int start = target.size();
|
int start = target.size();
|
||||||
target.add(Instruction.nop());
|
target.add(Instruction.nop());
|
||||||
target.add(Instruction.discard().locate(loc()));
|
if (pollute) target.add(Instruction.discard().locate(loc()));
|
||||||
second.compile(target, scope, pollute);
|
second.compile(target, scope, pollute);
|
||||||
target.set(start, Instruction.jmpIfNot(target.size() - start).locate(loc()));
|
target.set(start, Instruction.jmpIfNot(target.size() - start).locate(loc()));
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class LazyOrStatement extends Statement {
|
|||||||
if (pollute) target.add(Instruction.dup().locate(loc()));
|
if (pollute) target.add(Instruction.dup().locate(loc()));
|
||||||
int start = target.size();
|
int start = target.size();
|
||||||
target.add(Instruction.nop());
|
target.add(Instruction.nop());
|
||||||
target.add(Instruction.discard().locate(loc()));
|
if (pollute) target.add(Instruction.discard().locate(loc()));
|
||||||
second.compile(target, scope, pollute);
|
second.compile(target, scope, pollute);
|
||||||
target.set(start, Instruction.jmpIf(target.size() - start).locate(loc()));
|
target.set(start, Instruction.jmpIf(target.size() - start).locate(loc()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user