Hi Everyone,

with the following source code:

function myFunc(a, b, c) {
  let sum = a + b + c ;
  return sum / 3 ;
}

p("the string is: " + myFunc.toString()) ;

I get the following output:

the string is:
function myFunc(a, b, c) {
    let sum = a + b + creturn sum / 3;
}

Applying the following patch:

diff -r -u mozilla/js/rhino/src/org/mozilla/javascript/Parser.java
mozilla-patched/js/rhino/src/org/mozilla/javascript/Parser.java
--- mozilla/js/rhino/src/org/mozilla/javascript/Parser.java     2008-04-19
18:53:24.000000000 -0700
+++ mozilla-patched/js/rhino/src/org/mozilla/javascript/Parser.java
2008-05-13 12:46:51.000000000 -0700
@@ -1117,7 +1117,7 @@
             } else {
                 pn = variables(false, tt);
             }
-            return pn;
+            break;
           }

           case Token.RETURN:

gives the following (presumably correct) output:

the string is:
function myFunc(a, b, c) {
    let sum = a + b + c;
    return sum / 3;
}

Let me know if anyone sees a problem with this!

Thanks,
Ben
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to