generators get incorrect arguments.length

RESOLVED FIXED

Status

()

RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: donny.viszneki, Assigned: jorendorff)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
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)

Updated

9 years ago
Assignee: general → jorendorff
(Assignee)

Updated

9 years ago
Attachment #415741 - Flags: review?(brendan)
(Assignee)

Comment 3

9 years ago
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+

Comment 5

9 years ago
http://hg.mozilla.org/mozilla-central/rev/8abbf11c0724
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.