Closed
Bug 1107418
Opened 10 years ago
Closed 9 years ago
Destructuring assignment of function arguments object is broken
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla46
People
(Reporter: torbasow, Unassigned)
References
Details
(Keywords: regression, reproducible, testcase)
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
Build ID: 20141113143407
Steps to reproduce:
(function test(a, b){let [x, y]=arguments;})(1,2);
Actual results:
undefined
Expected results:
TypeError: arguments['@@iterator'] is not a function
Reporter | ||
Comment 1•10 years ago
|
||
This works fine in Firefox 15, 21, 24, 25, 30, 32 and 33, although arguments was not iterable at Fx24 yet (bug 1067049). Try (function test(a, b){for(x of arguments);})(1,2). This works in Fx15 and doesn’t work in Fx24 and later.
Comment 2•10 years ago
|
||
2014-12-07-03-02-05-mozilla-central-firefox-37.0a1.ru.linux-x86_64
(function test(a, b){let [x, y]=arguments;})(1,2);
Exception: arguments[Symbol.iterator] is not a function
(function test(a, b){for(x of arguments);})(1,2)
Exception: arguments[Symbol.iterator] is not a function
QA Whiteboard: [bugday-20141208]
Comment 3•10 years ago
|
||
Jan, was this a deliberate change? I don't know enough about the spec here to know if this is supposed to work...
Component: Untriaged → JavaScript Engine
Flags: needinfo?(jdemooij)
Product: Firefox → Core
Summary: Restructuring assignment of arguments was broken → Destructuring assignment of function arguments object is broken
Comment 4•10 years ago
|
||
Problem is that `arguments` object don't have a Symbol.iterator property. In the spec I don't see @@iterator defined for arguments objects but maybe I'm missing something...
Flags: needinfo?(jdemooij) → needinfo?(jorendorff)
Comment 5•10 years ago
|
||
Per spec, "let [x, y] = foo" iterates foo twice and assigns the results to x and y.
Also per spec afaict arguments objects should be iterable, but we haven't fixed bug 1067049 yet. Presumably we should just fix that.
Depends on: 1067049
Comment 6•10 years ago
|
||
> In the spec I don't see @@iterator defined for arguments objects
It's in step 22 of http://people.mozilla.org/~jorendorff/es6-draft.html#sec-createmappedargumentsobject and step 7 of http://people.mozilla.org/~jorendorff/es6-draft.html#sec-createunmappedargumentsobject
Comment 7•10 years ago
|
||
Ah thanks Boris. Not sure how I missed that when I searched for @@iterator...
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(jorendorff)
Updated•9 years ago
|
Keywords: regressionwindow-wanted
Comment 8•9 years ago
|
||
Yup, this works now that bug 1067049 is fixed.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in
before you can comment on or make changes to this bug.
Description
•