Closed
Bug 382673
Opened 18 years ago
Closed 18 years ago
js1_7/lexical/regress-351515.js FAILS - function yield() is syntax error
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: bc, Unassigned)
References
Details
(Keywords: regression)
bug 380237 regressed function yield() {}
Comment 1•18 years ago
|
||
That's not true:
js> version(170)
0
js> function yield(){}
js> this.yield()
The failure that I see from the test is:
FAILED! expected: Expected value 'SyntaxError: yield not in function', Actual value 'SyntaxError: syntax error'
Sure enough, running the 1.8.1 shell:
$ ../srcmoz18/Darwin_DBG.OBJ/js -v 170
js> yield = 1
typein:1: SyntaxError: yield not in function:
typein:1: yield = 1
typein:1: ^
But in a trunk shell:
$ ./Darwin_DBG.OBJ/js -v 170
js> yield = 1
typein:1: SyntaxError: syntax error:
typein:1: yield = 1
typein:1: ......^
The reason is that checking for yield outside of a function had to move to a later compilation phase to allow for generator expressions, which can yield in their left-side-of-|for| operand, even if the genexp is outside of a function (since the genexp is sugar for its own generator function).
The new error is generic, but actually seems better to me. The old error seemed confused about yield = 1 being a yield expression, when it could not have been yielding " = 1" -- it was clearly an assignment expression.
Let me know if you think this needs a more precise error message. Otherwise please INVALIDate it and change the suite to match.
/be
| Reporter | ||
Comment 2•18 years ago
|
||
/cvsroot/mozilla/js/tests/js1_7/lexical/regress-351515.js,v <-- regress-351515.js
new revision: 1.3; previous revision: 1.2
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•