| Index: mozilla-tests/js1_8/genexps/regress-380237-04.js
 | 
| ===================================================================
 | 
| --- mozilla-tests/js1_8/genexps/regress-380237-04.js	(revision 43940)
 | 
| +++ mozilla-tests/js1_8/genexps/regress-380237-04.js	(working copy)
 | 
| @@ -67,114 +67,114 @@
 | 
|  // generator expression!
 | 
|  
 | 
|  // Statements
 | 
| -doesNotNeedParens("if (xx) { }");
 | 
| -needParens("if (1, xx) { }");
 | 
| -needParens("if (xx, 1) { }");
 | 
| -doesNotNeedParens("do { } while (xx);");
 | 
| -doesNotNeedParens("while (xx) { }");
 | 
| -doesNotNeedParens("switch (xx) { }");
 | 
| -doesNotNeedParens("with (xx) { }");
 | 
| -needParens("switch (x) { case xx: }");
 | 
| -needParens("return xx;");
 | 
| -needParens("yield xx;");
 | 
| -needParens("for (xx;;) { }");
 | 
| -needParens("for (;xx;) { }", "function anonymous() {\n    for (;;) {\n    }\n}");
 | 
| -needParens("for (;;xx) { }");
 | 
| -needParens("for (i in xx) { }");
 | 
| -needParens("throw xx");
 | 
| -needParens("try { } catch (e if xx) { }");
 | 
| -needParens("let (x=3) xx");
 | 
| -needParens("let (x=xx) 3");
 | 
| +doesNotNeedParens(1, "if (xx) { }");
 | 
| +needParens(2, "if (1, xx) { }");
 | 
| +needParens(3, "if (xx, 1) { }");
 | 
| +doesNotNeedParens(4, "do { } while (xx);");
 | 
| +doesNotNeedParens(5, "while (xx) { }");
 | 
| +doesNotNeedParens(6, "switch (xx) { }");
 | 
| +doesNotNeedParens(7, "with (xx) { }");
 | 
| +needParens(8, "switch (x) { case xx: }");
 | 
| +needParens(9, "return xx;");
 | 
| +needParens(10, "yield xx;");
 | 
| +needParens(11, "for (xx;;) { }");
 | 
| +needParens(12, "for (;xx;) { }", "function anonymous() {\n    for (;;) {\n    }\n}");
 | 
| +needParens(13, "for (;;xx) { }");
 | 
| +needParens(14, "for (i in xx) { }");
 | 
| +needParens(15, "throw xx");
 | 
| +needParens(16, "try { } catch (e if xx) { }");
 | 
| +needParens(17, "let (x=3) xx");
 | 
| +needParens(18, "let (x=xx) 3");
 | 
|  
 | 
|  // Function calls
 | 
| -doesNotNeedParens("f(xx);");
 | 
| -needParens("f(xx, 1);");
 | 
| -needParens("f(1, xx);");
 | 
| -doesNotNeedParens("/x/(xx);");
 | 
| -needParens("/x/(xx, 1);");
 | 
| -needParens("/x/(1, xx);");
 | 
| +doesNotNeedParens(19, "f(xx);");
 | 
| +needParens(20, "f(xx, 1);");
 | 
| +needParens(21, "f(1, xx);");
 | 
| +doesNotNeedParens(22, "/x/(xx);");
 | 
| +needParens(23, "/x/(xx, 1);");
 | 
| +needParens(24, "/x/(1, xx);");
 | 
|  
 | 
|  // eval is special and often confuses the decompiler.
 | 
| -doesNotNeedParens("eval(xx);");
 | 
| -needParens("eval(xx, 1);");
 | 
| -needParens("eval(1, xx);");
 | 
| +doesNotNeedParens(25, "eval(xx);");
 | 
| +needParens(26, "eval(xx, 1);");
 | 
| +needParens(27, "eval(1, xx);");
 | 
|  
 | 
|  // Expressions
 | 
| -needParens("xx;");            // ???
 | 
| -needParens("var g = xx;");    // ???
 | 
| -needParens("g += xx;");
 | 
| -needParens("xx();");
 | 
| -needParens("xx() = 3;");
 | 
| -needParens("a ? xx : c");
 | 
| -needParens("xx ? b : c");
 | 
| -needParens("a ? b : xx");
 | 
| -needParens("1 ? xx : c");
 | 
| -needParens("0 ? b : xx");
 | 
| -needParens("1 + xx");
 | 
| -needParens("xx + 1");
 | 
| -needParens("1, xx");
 | 
| -doesNotNeedParens("+(xx)");
 | 
| -doesNotNeedParens("!(xx)");
 | 
| -needParens("xx, 1");
 | 
| -needParens("[1, xx]");
 | 
| -needParens("[xx, 1]");
 | 
| -needParens("[#1=xx,3]");
 | 
| -needParens("[#1=xx,#1#]");
 | 
| -needParens("xx.p");
 | 
| -needParens("xx.@p");
 | 
| -needParens("typeof xx;");
 | 
| -needParens("void xx;");
 | 
| -needParens("({ a: xx })");
 | 
| -needParens("({ a: 1, b: xx })");
 | 
| -needParens("({ a: xx, b: 1 })");
 | 
| -needParens("({ a getter: xx })");
 | 
| -needParens("<x a={xx}/>");
 | 
| -doesNotNeedParens("new (xx);");
 | 
| -doesNotNeedParens("new a(xx);");
 | 
| +needParens(28, "xx;");            // ???
 | 
| +needParens(29, "var g = xx;");    // ???
 | 
| +needParens(30, "g += xx;");
 | 
| +needParens(31, "xx();");
 | 
| +needParens(32, "xx() = 3;");
 | 
| +needParens(33, "a ? xx : c");
 | 
| +needParens(34, "xx ? b : c");
 | 
| +needParens(35, "a ? b : xx");
 | 
| +needParens(36, "1 ? xx : c");
 | 
| +needParens(37, "0 ? b : xx");
 | 
| +needParens(38, "1 + xx");
 | 
| +needParens(39, "xx + 1");
 | 
| +needParens(40, "1, xx");
 | 
| +doesNotNeedParens(41, "+(xx)");
 | 
| +doesNotNeedParens(42, "!(xx)");
 | 
| +needParens(43, "xx, 1");
 | 
| +needParens(44, "[1, xx]");
 | 
| +needParens(45, "[xx, 1]");
 | 
| +needParens(46, "[#1=xx,3]");
 | 
| +needParens(47, "[#1=xx,#1#]");
 | 
| +needParens(48, "xx.p");
 | 
| +needParens(49, "xx.@p");
 | 
| +needParens(50, "typeof xx;");
 | 
| +needParens(51, "void xx;");
 | 
| +needParens(52, "({ a: xx })");
 | 
| +needParens(53, "({ a: 1, b: xx })");
 | 
| +needParens(54, "({ a: xx, b: 1 })");
 | 
| +needParens(55, "({ a getter: xx })");
 | 
| +needParens(56, "<x a={xx}/>");
 | 
| +doesNotNeedParens(57, "new (xx);");
 | 
| +doesNotNeedParens(58, "new a(xx);");
 | 
|  
 | 
|  
 | 
|  // Generator expressions cannot be used as LHS, even though they're syntactic 
 | 
|  // sugar for something that looks a lot like an "lvalue return": (f() = 3).
 | 
|  
 | 
| -rejectLHS("++ (xx);");
 | 
| -rejectLHS("delete xx;");
 | 
| -rejectLHS("delete (xx);");
 | 
| -rejectLHS("for (xx in []) { }");
 | 
| -rejectLHS("for ((xx) in []) { }");
 | 
| -rejectLHS("try { } catch(xx) { }");
 | 
| -rejectLHS("try { } catch([(xx)]) { }");
 | 
| -rejectLHS("xx += 3;");
 | 
| -rejectLHS("(xx) += 3;");
 | 
| -rejectLHS("xx = 3;");
 | 
| +rejectLHS(59, "++ (xx);");
 | 
| +rejectLHS(60, "delete xx;");
 | 
| +rejectLHS(61, "delete (xx);");
 | 
| +rejectLHS(62, "for (xx in []) { }");
 | 
| +rejectLHS(63, "for ((xx) in []) { }");
 | 
| +rejectLHS(64, "try { } catch(xx) { }");
 | 
| +rejectLHS(65, "try { } catch([(xx)]) { }");
 | 
| +rejectLHS(66, "xx += 3;");
 | 
| +rejectLHS(67, "(xx) += 3;");
 | 
| +rejectLHS(68, "xx = 3;");
 | 
|  
 | 
|  // Assignment
 | 
| -rejectLHS("        (xx) = 3;");
 | 
| -rejectLHS("var     (xx) = 3;");
 | 
| -rejectLHS("const   (xx) = 3;");
 | 
| -rejectLHS("let     (xx) = 3;");
 | 
| +rejectLHS(69, "        (xx) = 3;");
 | 
| +rejectLHS(70, "var     (xx) = 3;");
 | 
| +rejectLHS(71, "const   (xx) = 3;");
 | 
| +rejectLHS(72, "let     (xx) = 3;");
 | 
|  
 | 
|  // Destructuring assignment
 | 
| -rejectLHS("        [(xx)] = 3;");
 | 
| -rejectLHS("var     [(xx)] = 3;");
 | 
| -rejectLHS("const   [(xx)] = 3;");
 | 
| -rejectLHS("let     [(xx)] = 3;");
 | 
| +rejectLHS(73, "        [(xx)] = 3;");
 | 
| +rejectLHS(74, "var     [(xx)] = 3;");
 | 
| +rejectLHS(75, "const   [(xx)] = 3;");
 | 
| +rejectLHS(76, "let     [(xx)] = 3;");
 | 
|  
 | 
|  // Group assignment (Spidermonkey optimization for certain
 | 
|  // destructuring assignments)
 | 
| -rejectLHS("        [(xx)] = [3];");
 | 
| -rejectLHS("var     [(xx)] = [3];");
 | 
| -rejectLHS("const   [(xx)] = [3];");
 | 
| -rejectLHS("let     [(xx)] = [3];");
 | 
| +rejectLHS(77, "        [(xx)] = [3];");
 | 
| +rejectLHS(78, "var     [(xx)] = [3];");
 | 
| +rejectLHS(79, "const   [(xx)] = [3];");
 | 
| +rejectLHS(80, "let     [(xx)] = [3];");
 | 
|  
 | 
|  // Destructuring & group assignment for array comprehensions, just for kicks.
 | 
| -rejectLHS("        [xx] = [3];");
 | 
| -rejectLHS("var     [xx] = [3];");
 | 
| -rejectLHS("const   [xx] = [3];");
 | 
| -rejectLHS("let     [xx] = 3;");
 | 
| -rejectLHS("        [xx] = 3;");
 | 
| -rejectLHS("var     [xx] = 3;");
 | 
| -rejectLHS("const   [xx] = 3;");
 | 
| -rejectLHS("let     [xx] = 3;");
 | 
| +rejectLHS(81, "        [xx] = [3];");
 | 
| +rejectLHS(82, "var     [xx] = [3];");
 | 
| +rejectLHS(83, "const   [xx] = [3];");
 | 
| +rejectLHS(84, "let     [xx] = 3;");
 | 
| +rejectLHS(85, "        [xx] = 3;");
 | 
| +rejectLHS(86, "var     [xx] = 3;");
 | 
| +rejectLHS(87, "const   [xx] = 3;");
 | 
| +rejectLHS(88, "let     [xx] = 3;");
 | 
|  
 | 
|  // This is crazy, ambiguous, and/or buggy.
 | 
|  // See https://bugzilla.mozilla.org/show_bug.cgi?id=380237#c23 et seq.
 | 
| @@ -182,12 +182,12 @@
 | 
|  
 | 
|  print("Done!");
 | 
|  
 | 
| -function doesNotNeedParens(pat)
 | 
| +function doesNotNeedParens(section, pat)
 | 
|  {
 | 
| -  print("Testing " + pat);
 | 
| +  print("Testing section " + section + " pattern " + pat);
 | 
|  
 | 
|    var f, ft;
 | 
| -  sanityCheck(pat);
 | 
| +  sanityCheck(section, pat);
 | 
|  
 | 
|    expect = 'No Error';
 | 
|    actual = '';
 | 
| @@ -199,24 +199,24 @@
 | 
|        print("Unparenthesized genexp SHOULD have been accepted here!");
 | 
|        actual = e + '';
 | 
|      }
 | 
| -  reportCompare(expect, actual, summary + ': doesNotNeedParens ' + pat);
 | 
| +  reportCompare(expect, actual, summary + ': doesNotNeedParens section ' + section + ' pattern ' + pat);
 | 
|  
 | 
| -  roundTripTest(f);
 | 
| +  roundTripTest(section, f);
 | 
|  
 | 
|    // Make sure the decompilation is not over-parenthesized.
 | 
|    var uf = "" + f;
 | 
|    if (pat.indexOf("(xx)") != -1)
 | 
| -    overParenTest(f);
 | 
| +    overParenTest(section, f);
 | 
|    //  else
 | 
|    //    print("Skipping the over-parenthesization test, because I don't know how to test for over-parenthesization when the pattern doesn't have parens snugly around it.")
 | 
|  }
 | 
|  
 | 
| -function needParens(pat, exp)
 | 
| +function needParens(section, pat, exp)
 | 
|  {
 | 
| -  print("Testing " + pat);
 | 
| +  print("Testing section " + section + " pattern " + pat);
 | 
|  
 | 
|    var f, ft;
 | 
| -  sanityCheck(pat);
 | 
| +  sanityCheck(section, pat);
 | 
|  
 | 
|    expect = 'SyntaxError';
 | 
|    actual = '';
 | 
| @@ -228,7 +228,7 @@
 | 
|      /* expected to throw */ 
 | 
|      actual = e.name;
 | 
|    }
 | 
| -  reportCompare(expect, actual, summary + ': needParens ' + pat);
 | 
| +  reportCompare(expect, actual, summary + ': needParens section ' + section + ' pattern ' + pat);
 | 
|  
 | 
|    expect = 'No Error';
 | 
|    actual = '';
 | 
| @@ -240,15 +240,15 @@
 | 
|      print("Yikes!"); 
 | 
|      actual = e + '';
 | 
|    }
 | 
| -  reportCompare(expect, actual, summary + ': needParens ' + ft);
 | 
| +  reportCompare(expect, actual, summary + ': needParens section ' + section + ' ft ' + ft);
 | 
|  
 | 
| -  roundTripTest(f, exp);
 | 
| -  overParenTest(f, exp);
 | 
| +  roundTripTest(section, f, exp);
 | 
| +  overParenTest(section, f, exp);
 | 
|  }
 | 
|  
 | 
| -function rejectLHS(pat)
 | 
| +function rejectLHS(section, pat)
 | 
|  {
 | 
| -  print("Testing " + pat);
 | 
| +  print("Testing section " + section + " pattern " + pat);
 | 
|  
 | 
|    // sanityCheck(pat); // because 'z' should be accepted as an LHS or binding
 | 
|      
 | 
| @@ -264,26 +264,26 @@
 | 
|      } catch(e) { 
 | 
|        actual = e.name;
 | 
|      }
 | 
| -  reportCompare(expect, actual, summary + ': rejectLHS');
 | 
| +  reportCompare(expect, actual, summary + ': rejectLHS section ' + section);
 | 
|  }
 | 
|  
 | 
|  
 | 
| -function overParenTest(f, exp)
 | 
| +function overParenTest(section, f, exp)
 | 
|  {
 | 
|    var uf = "" + f;
 | 
|    if (uf == exp)
 | 
|      return;
 | 
|  
 | 
|    reportCompare(false, uf.indexOf(genexpParened) == -1, summary + 
 | 
| -                ': overParenTest genexp snugly in parentheses: ' + uf);
 | 
| +                ': overParenTest genexp snugly in parentheses: section ' + section + ' uf ' + uf);
 | 
|  
 | 
|    if (uf.indexOf(genexpParened) != -1) {
 | 
|      reportCompare(true, uf.indexOf(genexpParenedTwice) == -1, summary + 
 | 
| -      ': overParensTest decompilation should not be over-parenthesized: ' + uf);
 | 
| +      ': overParensTest decompilation should not be over-parenthesized: section ' + ' uf ' + uf);
 | 
|    }
 | 
|  }
 | 
|  
 | 
| -function sanityCheck(pat)
 | 
| +function sanityCheck(section, pat)
 | 
|  {
 | 
|    expect = '';
 | 
|    actual = '';
 | 
| @@ -300,10 +300,10 @@
 | 
|    } catch(e) { 
 | 
|      actual += "Yowzers! Probably a bogus test!";
 | 
|    }
 | 
| -  reportCompare(expect, actual, summary + ': sanityCheck ' + pat);
 | 
| +  reportCompare(expect, actual, summary + ': sanityCheck section ' + section + ' pattern ' + pat);
 | 
|  }
 | 
|  
 | 
| -function roundTripTest(f, exp)
 | 
| +function roundTripTest(section, f, exp)
 | 
|  {
 | 
|    // Decompile
 | 
|    var uf = "" + f;
 | 
| @@ -315,15 +315,15 @@
 | 
|    try {
 | 
|      euf = eval("(" + uf + ")");
 | 
|      actual = 'No Error';
 | 
| -    reportCompare(expect, actual, summary + ': roundTripTest: ' + uf);
 | 
| +    reportCompare(expect, actual, summary + ': roundTripTest: section ' + section + ' uf ' + uf);
 | 
|    } catch(e) {
 | 
|      actual = e + '';
 | 
| -    reportCompare(expect, actual, summary + ': roundTripTest: ' + uf);
 | 
| +    reportCompare(expect, actual, summary + ': roundTripTest: section ' + section + ' uf ' + uf);
 | 
|      return;
 | 
|    }
 | 
|  
 | 
|    // Decompile again and make sure the decompilations match exactly.
 | 
|    expect = exp || uf;
 | 
|    actual = "" + euf;
 | 
| -  reportCompare(expect, actual, summary + ': roundTripTest no round-trip change');
 | 
| +  reportCompare(expect, actual, summary + ': roundTripTest no round-trip change: section ' + section);
 | 
|  }
 | 
| 
 |