Closed Bug 352441 Opened 18 years ago Closed 17 years ago

Decompilation of "case (yield):" does not compile

Categories

(Core :: JavaScript Engine, defect, P2)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9alpha4

People

(Reporter: jruderman, Assigned: brendan)

References

Details

(Keywords: testcase)

Attachments

(1 file)

js> function() { switch (x) { case (yield): } }
function () {
    switch (x) {
      case yield:
      default:;
    }
}

js> function () { switch (x) { case yield: } }
syntax error
Is this a bug in the decompiler or a bug in the compiler?

Why is "case yield:" a syntax error while "case yield 5:" is accepted?
I think case yield: should not be an error.  The E262-3 grammar says a case label is an Expression (Expr in jsparse.c terms).  There's no problem with , as in an argument list.  Comments?

/be
js> new Function("switch(w) { case yield\n: x }")

somehow compiles, but its decompilation of course doesn't compile.
WFM: "case yield:" is now accepted.
Status: NEW → RESOLVED
Closed: 17 years ago
Flags: in-testsuite?
Resolution: --- → WORKSFORME
D'oh, I was testing without "-v 170".
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Attached patch fixSplinter Review
Assignee: general → brendan
Status: REOPENED → ASSIGNED
Attachment #260561 - Flags: review?(mrbkap)
OS: Mac OS X → All
Priority: -- → P2
Hardware: Macintosh → All
Target Milestone: --- → mozilla1.9alpha4
Attachment #260561 - Flags: review?(mrbkap) → review+
Fixed on trunk:

js/src/jsparse.c 3.275

/be
Blocks: js1.7src
Status: ASSIGNED → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
/cvsroot/mozilla/js/tests/js1_7/decompilation/regress-352441.js,v  <--  regress-352441.js
initial revision: 1.1
Flags: in-testsuite? → in-testsuite+
verified fixed on trunk.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: