Arguments instantiation by destructuring assignment has no effect on current draft

# Yusuke Suzuki (13 years ago)

Hello everyone,

I'm now implementing ES.next engine in ES5.1 and I may find issue on current draft.

In June 15 draft, to realize destructuring assignment in FormalParameters, we perform Binding Initialisation for formals with Arguments object.

In section 10.5.3, step 8-d,

d. Let formalStatus be the result of performing Binding Initialisation

for formals with ao and undefined as arguments.

But, ao.[[Get]], ao.[[GetOwnProperty]] have been already overriden to mapped arguments special internal methods in non-strict function.

For example,

function test(a) { } test(10);

In this script, we perform Indexed Binding Initialisation and finally, we perform ao.[Get]. But, in this phase, 'a' entry of environmental record is initialized to undefined in 10.5.3-5-c-ii-1, so ao's getter defined in CreateMappedArgumentsObject step 7-c-ii-2,

function () { return a; }

always returns undefined. As the result, ao.[[Get]] result is always undefined, and we cannot initialize argument by correct value.

I think it is issue of current draft, is it right?

To fix this, I suggest creating JS Array from argumentsList and performing Binding Initialisation with it, or delaying internal method override phase of ao.

, Yusuke Suzuki