Closed Bug 530879 Opened 15 years ago Closed 15 years ago

generators get incorrect arguments.length

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: donny.viszneki, Assigned: jorendorff)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.15) Gecko/2009102815 Ubuntu/9.04 (jaunty) Firefox/3.0.15
Build Identifier: revision 2f75734c2211 and others

Generators seem to get an incorrect arguments.length. It seems that arguments.length is always the length of the argument vector in the generator function's definition, not the length of the argument vector from the generator's constructor invocation.

Reproducible: Always

Steps to Reproduce:
js -e 'print((function(a,b,c,d){yield arguments.length})().next()===4)'
Actual Results:  
true

Expected Results:  
false

Have a nice day :)
Thanks, Donny. Gives false in 1.9.0 (firefox 3) era js shell. Did this regress recently? Any bisect help appreciated.

/be
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: general → jorendorff
Attached patch v1Splinter Review
Attachment #415741 - Flags: review?(brendan)
Comment on attachment 415741 [details] [diff] [review]
v1

Introduced here:

http://hg.mozilla.org/tracemonkey/diff/471f34aa61df/js/src/jsiter.cpp

The code used to say

  gen->frame.argc = argc;

not nargs, but that was obscured by a macro.
Comment on attachment 415741 [details] [diff] [review]
v1

Nice, thanks for patching. And thanks again to Donny for noticing!

/be
Attachment #415741 - Flags: review?(brendan) → review+
http://hg.mozilla.org/mozilla-central/rev/8abbf11c0724
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: