diff --git a/src/me/topchetoeu/jscript/compilation/values/LazyAndStatement.java b/src/me/topchetoeu/jscript/compilation/values/LazyAndStatement.java index d71ab81..fea8de5 100644 --- a/src/me/topchetoeu/jscript/compilation/values/LazyAndStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/LazyAndStatement.java @@ -29,7 +29,7 @@ public class LazyAndStatement extends Statement { if (pollute) target.add(Instruction.dup().locate(loc())); int start = target.size(); target.add(Instruction.nop()); - target.add(Instruction.discard().locate(loc())); + if (pollute) target.add(Instruction.discard().locate(loc())); second.compile(target, scope, pollute); target.set(start, Instruction.jmpIfNot(target.size() - start).locate(loc())); } diff --git a/src/me/topchetoeu/jscript/compilation/values/LazyOrStatement.java b/src/me/topchetoeu/jscript/compilation/values/LazyOrStatement.java index 476a546..3e896dd 100644 --- a/src/me/topchetoeu/jscript/compilation/values/LazyOrStatement.java +++ b/src/me/topchetoeu/jscript/compilation/values/LazyOrStatement.java @@ -29,7 +29,7 @@ public class LazyOrStatement extends Statement { if (pollute) target.add(Instruction.dup().locate(loc())); int start = target.size(); target.add(Instruction.nop()); - target.add(Instruction.discard().locate(loc())); + if (pollute) target.add(Instruction.discard().locate(loc())); second.compile(target, scope, pollute); target.set(start, Instruction.jmpIf(target.size() - start).locate(loc())); }