Closed
Bug 351336
Opened 19 years ago
Closed 19 years ago
Loss of parens in "for" initial-expression using "in" operator causes syntax error
Categories
(Core :: JavaScript Engine, defect, P2)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.8.1
People
(Reporter: jruderman, Assigned: brendan)
Details
(Keywords: testcase, verified1.8.1)
Attachments
(1 file)
1.08 KB,
patch
|
mrbkap
:
review+
mtschrep
:
approval1.8.1+
|
Details | Diff | Splinter Review |
> function () { for (("p" in a); 0;) { } }
function () { for ("p" in a; 0;) { } }
> function () { for ("p" in a; 0;) { } }
SyntaxError on line 1: invalid for/in left-hand side
This could be fixed by:
(1) Keeping the parens intact during decompilation (see also bug 351104, a round-trip change that involves loss of parens in a "for" initial-expression)
(2) Allowing the second line to compile, by not treating the "in" as an attempt to create a for-in loop if there's a semicolon present.
Assignee | ||
Comment 1•19 years ago
|
||
(In reply to comment #0)
> > function () { for (("p" in a); 0;) { } }
> function () { for ("p" in a; 0;) { } }
>
> > function () { for ("p" in a; 0;) { } }
> SyntaxError on line 1: invalid for/in left-hand side
>
> This could be fixed by:
>
> (1) Keeping the parens intact during decompilation (see also bug 351104, a
> round-trip change that involves loss of parens in a "for" initial-expression)
>
> (2) Allowing the second line to compile, by not treating the "in" as an attempt
> to create a for-in loop if there's a semicolon present.
(1) is the only way, as (2) requires either unbounded lookahead for a top-down parser, or a bottom-up parser, and requiring either of those implementations is neither desirable nor conformant with ECMA-262.
/be
OS: Mac OS X 10.4 → All
Hardware: Macintosh → All
Assignee | ||
Comment 2•19 years ago
|
||
Simple patch (this is against the 1.8 branch; trunk patch is the same unless the patch for bug 350531 gets review soon -- hint hint ;-).
/be
Assignee | ||
Updated•19 years ago
|
Priority: -- → P2
Target Milestone: --- → mozilla1.8.1
Updated•19 years ago
|
Attachment #236739 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 3•19 years ago
|
||
Fixed on trunk.
/be
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•19 years ago
|
Attachment #236739 -
Flags: approval1.8.1?
Comment 4•19 years ago
|
||
Comment on attachment 236739 [details] [diff] [review]
fix
a=schrep for drivers.
Attachment #236739 -
Flags: approval1.8.1? → approval1.8.1+
Comment 6•19 years ago
|
||
Checking in regress-351336.js;
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-351336.js,v <-- regress-351336.js
initial revision: 1.1
Flags: in-testsuite+
Comment 7•19 years ago
|
||
verified fixed 1.8, 1.9 20060906 windows/mac*/linux
Status: RESOLVED → VERIFIED
Keywords: fixed1.8.1 → verified1.8.1
You need to log in
before you can comment on or make changes to this bug.
Description
•