michael@0: var otherGlobalSameCompartment = newGlobal("same-compartment"); michael@0: eval = otherGlobalSameCompartment.eval; michael@0: doesNotNeedParens(1, "if (xx) { }"); michael@0: needParens(2, "if (1, xx) { }"); michael@0: function doesNotNeedParens(section, pat) { michael@0: try { michael@0: f = new Function michael@0: } catch (e) {} michael@0: roundTripTest(section, f) michael@0: } michael@0: function needParens(section, pat, exp) { michael@0: var f, ft; michael@0: roundTripTest(section, f, exp) michael@0: } michael@0: function roundTripTest(section, f, exp) { michael@0: uf = "" + f michael@0: var euf; michael@0: try { michael@0: euf = eval("(" + uf + ")"); michael@0: } catch (e) { } michael@0: + euf michael@0: }