Closed Bug 462309 Opened 16 years ago Closed 12 years ago

Decompilation is not accepted, involving "let" and serial evaluation comma

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: regression, testcase)

js> f = (function() { (let (y) y, y) })
function () {
    let (y) y, y;
}
js> eval(uneval(f))
typein:2: SyntaxError: missing ; before statement:
typein:2: (function () {let (y) y, y;})
typein:2: ......................^

Dunno which step is wrong.
mrbkap: do you remember why 'let (head) expr' at the start of a statement must be parenthesized if it is an operand in a comma expression? The expr is supposed to be an assignment expression, which is what comma expression produces.

/be
Well, we call AssignExpr, but that doesn't include the comma operator. Expr does. Are the functions misnamed?
(In reply to comment #2)
> Well, we call AssignExpr, but that doesn't include the comma operator. Expr
> does. Are the functions misnamed?

Not really: Expr is the goal symbol for the expression sub-grammar, and we want let expression bodies to be assignment expressions. The problem is that we do not keep parsing after the let expression on the left of comma. This reminds me of the bug Waldemar pointed out:

let (a = 1) a ? f : x++();

x++() is not valid syntax by itself, but a bottom-up parser would recognize the (let (a = 1) a ? f : x++) as the callee.

/be
Oops. This is a two year old bug.
Assignee: general → mrbkap
Assignee: mrbkap → general
(In reply to Blake Kaplan (:mrbkap) from comment #4)
> Oops. This is a two year old bug.

Make that five ;)
OS: Mac OS X → All
Hardware: x86 → All
IIRC this is a conflict in the "grammar" (quotes because no such thing existed when I implemented this). I don't remember the details any more, though. dherman might know more, though!
Fixed by saving the source.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.