Closed
Bug 349851
Opened 18 years ago
Closed 18 years ago
"yield \n ,3" compiles, but its decompilation does not
Categories
(Core :: JavaScript Engine, defect, P1)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.8.1
People
(Reporter: jruderman, Assigned: brendan)
References
Details
(Keywords: testcase, verified1.8.1)
Attachments
(1 file)
|
1.15 KB,
patch
|
mrbkap
:
review+
mtschrep
:
approval1.8.1+
|
Details | Diff | Splinter Review |
> function(){ yield ,3 } function () { yield, 3; } > function () { yield, 3; } syntax error I don't know where the bug lies -- it could be that the first is accepted, the way the first decompiles, or that the second is not accepted.
Comment 1•18 years ago
|
||
def foo():
yield 12,42
returns the tuple (12, 42);
def foo():
yield, 42
is a syntax error, because top-level yield statements require parenthesization in Python. Enclosing parentheses results in a generator which yields None and on .next() throws StopIteration.
The latest ES4 dump on developer.m.o/es4/ gives the yield expression as "yield" AssignmentExpression without any [no line break here] between the two (as occurs with |return|, |continue|, and a few other constructs). My tendency would be to insert [no line break here] in the production to conform with return. If this were done, the former example would be a syntax error on the second line (",3"), and the latter would demonstrate the same behavior as the second Python example given here with parentheses inserted around the |yield|. If this isn't done, then I think both examples should be equivalent (yield undefined, on .next() throw).| Assignee | ||
Updated•18 years ago
|
Assignee: general → brendan
OS: Mac OS X 10.4 → All
Priority: -- → P1
Hardware: Macintosh → All
Target Milestone: --- → mozilla1.8.1
| Assignee | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
Flags: blocking1.8.1?
Updated•18 years ago
|
Flags: blocking1.8.1? → blocking1.8.1+
| Assignee | ||
Comment 2•18 years ago
|
||
Python doesn't have the comma operator at lower precedence than assignment, but JS does -- still, we need to reject yield, 3 and yield\n, 3 equally (also 1, yield\n, 3 -- hence the placement of the error check). /be
Attachment #236366 -
Flags: review?(mrbkap)
Updated•18 years ago
|
Attachment #236366 -
Flags: review?(mrbkap) → review+
| Assignee | ||
Updated•18 years ago
|
Attachment #236366 -
Flags: approval1.8.1?
| Assignee | ||
Comment 3•18 years ago
|
||
Fixed on trunk. /be
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment 4•18 years ago
|
||
Checking in regress-349851.js; /cvsroot/mozilla/js/tests/js1_7/geniter/regress-349851.js,v <-- regress-349851.js initial revision: 1.1
Flags: in-testsuite+
Comment 6•18 years ago
|
||
Comment on attachment 236366 [details] [diff] [review] fix a=schrep for drivers.
Attachment #236366 -
Flags: approval1.8.1? → approval1.8.1+
Comment 8•18 years ago
|
||
verified fixed 1.8 20060906 windows/mac*/linux
Keywords: fixed1.8.1 → verified1.8.1
You need to log in
before you can comment on or make changes to this bug.
Description
•