js/src/jit-test/tests/jaeger/bug663910.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/jaeger/bug663910.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,22 @@
     1.4 +var otherGlobalSameCompartment = newGlobal("same-compartment");
     1.5 +eval = otherGlobalSameCompartment.eval;
     1.6 +doesNotNeedParens(1, "if (xx) { }");
     1.7 +needParens(2, "if (1, xx) { }");
     1.8 +function doesNotNeedParens(section, pat) {
     1.9 +    try {
    1.10 +        f = new Function
    1.11 +    } catch (e) {}
    1.12 +    roundTripTest(section, f)
    1.13 +}
    1.14 +function needParens(section, pat, exp) {
    1.15 +    var f, ft;
    1.16 +    roundTripTest(section, f, exp)
    1.17 +}
    1.18 +function roundTripTest(section, f, exp) {
    1.19 +    uf = "" + f
    1.20 +    var euf;
    1.21 +    try {
    1.22 +      euf = eval("(" + uf + ")");
    1.23 +    } catch (e) { }
    1.24 +    + euf
    1.25 +}

mercurial