Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 var otherGlobalSameCompartment = newGlobal("same-compartment");
2 eval = otherGlobalSameCompartment.eval;
3 doesNotNeedParens(1, "if (xx) { }");
4 needParens(2, "if (1, xx) { }");
5 function doesNotNeedParens(section, pat) {
6 try {
7 f = new Function
8 } catch (e) {}
9 roundTripTest(section, f)
10 }
11 function needParens(section, pat, exp) {
12 var f, ft;
13 roundTripTest(section, f, exp)
14 }
15 function roundTripTest(section, f, exp) {
16 uf = "" + f
17 var euf;
18 try {
19 euf = eval("(" + uf + ")");
20 } catch (e) { }
21 + euf
22 }