blob: 33997a3c4c6d8f8aff5cdcee1011e93720344c84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
var otherGlobalSameCompartment = newGlobal("same-compartment");
eval = otherGlobalSameCompartment.eval;
doesNotNeedParens(1, "if (xx) { }");
needParens(2, "if (1, xx) { }");
function doesNotNeedParens(section, pat) {
try {
f = new Function
} catch (e) {}
roundTripTest(section, f)
}
function needParens(section, pat, exp) {
var f, ft;
roundTripTest(section, f, exp)
}
function roundTripTest(section, f, exp) {
uf = "" + f
var euf;
try {
euf = eval("(" + uf + ")");
} catch (e) { }
+ euf
}
|