Closed
Bug 345855
Opened 19 years ago
Closed 19 years ago
Syntax error with 'blank' yield expressions
Categories
(Core :: JavaScript Engine, defect, P1)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.8.1beta2
People
(Reporter: Seno.Aiko, Assigned: brendan)
References
Details
(Keywords: verified1.8.1)
Attachments
(1 file, 1 obsolete file)
1.06 KB,
patch
|
mrbkap
:
review+
beltzner
:
approval1.8.1+
|
Details | Diff | Splinter Review |
(Split from bug 326466 comment 143)
The following expressions give syntax errors but should be allowed (note that yield is not followed by an expression here)
x = 12 + (yield)
foo(yield)
I falsely claimed that the following expressions have the same problem but they're fine:
x = 12 + (yield 42)
foo(yield 42)
I don't know why Python doesn't allow "yield yield", maybe it's one of those "edge cases" mentioned in PEP 342?
Assignee | ||
Comment 1•19 years ago
|
||
Fairly straightforward fix. I chose to disallow yield yield ... to match Python.
/be
Assignee | ||
Updated•19 years ago
|
Priority: -- → P1
Target Milestone: --- → mozilla1.8.1beta2
Updated•19 years ago
|
Attachment #231203 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 2•19 years ago
|
||
The previous patch degraded error messages for cases such as return) gratuitously.
This patch also outlaws |yield yield|, to match Python.
/be
Attachment #231203 -
Attachment is obsolete: true
Attachment #231362 -
Flags: review?(mrbkap)
Assignee | ||
Comment 3•19 years ago
|
||
Comment on attachment 231362 [details] [diff] [review]
better fix
Grr, jetlag.
/be
Attachment #231362 -
Attachment is obsolete: true
Attachment #231362 -
Flags: review?(mrbkap)
Assignee | ||
Comment 4•19 years ago
|
||
Comment on attachment 231362 [details] [diff] [review]
better fix
No, this is fine. Not sure what I was seeing, but this works in my Minefield build, and it makes sense. I chose to test (tt != TOK_YIELD || ...) in the #if'd line in order to make clearer what is going on with the (tt2 != tt && ...) right-hand-side of || there.
/be
Attachment #231362 -
Attachment is obsolete: false
Attachment #231362 -
Flags: review?(mrbkap)
Updated•19 years ago
|
Attachment #231362 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 5•19 years ago
|
||
Comment on attachment 231362 [details] [diff] [review]
better fix
Fixed on trunk. This is another required js1.7 fix.
/be
Attachment #231362 -
Flags: approval1.8.1?
Assignee | ||
Updated•19 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Flags: blocking1.8.1?
Resolution: --- → FIXED
Comment 6•19 years ago
|
||
Comment on attachment 231362 [details] [diff] [review]
better fix
a=drivers, please land this on the MOZILLA_1_8_BRANCH.
Attachment #231362 -
Flags: approval1.8.1? → approval1.8.1+
Assignee | ||
Updated•19 years ago
|
Flags: blocking1.8.1?
Comment 8•19 years ago
|
||
Checking in regress-345855.js;
/cvsroot/mozilla/js/tests/js1_7/geniter/regress-345855.js,v <-- regress-345855.js
initial revision: 1.1
Flags: in-testsuite+
Comment 9•19 years ago
|
||
verified fixed 1.8, 1.9 windows/mac(ppc|tel)/linux 20060803
Status: RESOLVED → VERIFIED
Keywords: fixed1.8.1 → verified1.8.1
Comment 10•17 years ago
|
||
note, bug 384991 changed the behavior of js1_7/geniter/regress-345855.js on the trunk to no longer require yield be parenthesized which currently causes
expect = /SyntaxError: yield expression must be parenthesized/;
try
{
eval('(function (){foo(yield 42)})');
actual = 'No Error';
}
catch(ex)
{
actual = ex + '';
}
reportMatch(expect, actual, summary + ': function (){foo(yield 42)}');
to fail on spidermonkey trunk. I can either remove this test or change it to require no error which will show up on 1.8.1 as a known failure.
Boyd, fyi for rhino.
Comment 11•17 years ago
|
||
/cvsroot/mozilla/js/tests/js1_7/geniter/regress-345855.js,v <-- regress-345855.js
new revision: 1.6; previous revision: 1.5
You need to log in
before you can comment on or make changes to this bug.
Description
•