Closed Bug 1228821 Opened 6 years ago Closed 6 years ago

JS: Incorrect handling of arguments in arrow functions

Categories

(Core :: JavaScript Engine, defect)

42 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 889158

People

(Reporter: spike.foo, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Build ID: 20151110142142

Steps to reproduce:

I tried the following example from MDN (Arrow functions: Lexical arguments): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#Lexical_arguments

    function foo() {
      var f = (i) => arguments[0]+i; // foo's implicit arguments binding
      return f(2);
    }

    foo(1); // 3


Actual results:

foo(1) returned 4. ("arguments" refers to the arguments of f)


Expected results:

foo(1) returned 3. ("arguments" refers to the "arguments" in the enclosing scope, namely the implicit arguments array of foo)
The documentation has already been updated for a change which affects only Firefox 43 and newer. For this reason, you see different behavior in Firefox 42. The change can be found in bug 889158.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Resolution: --- → DUPLICATE
Duplicate of bug: 889158
You need to log in before you can comment on or make changes to this bug.