9.2.13 Function Declaration Instantiation(func, argumentsList, env ) Abstract
Operation
In general default parameter expressions cannot access inner function declarations. There is currently one exception to this rule: If the inner function declaration is named "arguments", default parameter expressions have access to that function.
Q: Is it necessary to handle this special case?
Test case:
---
function f1(g = arguments) {
function arguments() { }
}
f1(); // Throws ReferenceError: binding is not initialized: "arguments"
function f2(g = () => arguments) {
function arguments() { }
return g();
}
f2(); // Returns `function arguments() { }`
---
fixed in rev26.
Took some more redesign of 9.2.13. The result of your tests should be:
function f1(g = arguments) {
function arguments() { }
}
f1(); // No error, parameter list arguments binding is initialized: to arguments object
function f2(g = () => arguments) {
function arguments() { }
return g();
}
f2(); // Returns f2's arguments object
fixed in rev26