diff --git a/js/rhino/src/org/mozilla/javascript/IRFactory.java b/js/rhino/src/org/mozilla/javascript/IRFactory.java index d6ee49edfee..cd0955d6e0e 100644 --- a/js/rhino/src/org/mozilla/javascript/IRFactory.java +++ b/js/rhino/src/org/mozilla/javascript/IRFactory.java @@ -102,6 +102,10 @@ public class IRFactory { return new Node(TokenStream.EXPRSTMT, (Node) expr, lineno); } + public Object createExprStatementNoReturn(Object expr, int lineno) { + return new Node(TokenStream.POP, (Node) expr, lineno); + } + /** * Name */ diff --git a/js/rhino/src/org/mozilla/javascript/Parser.java b/js/rhino/src/org/mozilla/javascript/Parser.java index 50cc0d5e0c8..c4df685dce3 100644 --- a/js/rhino/src/org/mozilla/javascript/Parser.java +++ b/js/rhino/src/org/mozilla/javascript/Parser.java @@ -300,7 +300,7 @@ class Parser { // The following can be removed but then code generators should // be modified not to push on the stack function expression // statements - pn = nf.createExprStatement(pn, baseLineno); + pn = nf.createExprStatementNoReturn(pn, baseLineno); } // Add EOL but only if function is not part of expression, in which // case it gets SEMI + EOL from Statement.