Closed
Bug 350743
Opened 19 years ago
Closed 13 years ago
Decompilation can turn a generator function into a normal (yield-less) function
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: jruderman, Unassigned)
References
Details
(Keywords: testcase)
> z = function () { print(3); if(false) yield 4; }
function () { print(3); }
Calling z() returns a generator immediately, without printing 3. This seems consistent with http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7 :
"The function containing the yield keyword is a generator. When you call it, its formal parameters are bound to actual arguments, but its body isn't actually evaluated. Instead, a generator-iterator is returned."
But the decompilation of z() does not contain "yield" at all, so calling it does print 3. So z's decompilation is very different from z.
Comment 1•14 years ago
|
||
Current js shell results:
js> z = function () { print(3); if(false) yield 4; }
(function () {print(3);})
js> z()
({})
OS: Mac OS X → All
Hardware: PowerPC → All
| Reporter | ||
Comment 2•14 years ago
|
||
This will probably be fixed by the syntax change in bug 666399.
Depends on: harmony:generators
Comment 3•13 years ago
|
||
It ended up being fixed by saving the source.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•