archives

« Bugzilla Issues Index

#414 — Arguments instantiation by destructuring assignment has no effect


See https://mail.mozilla.org/pipermail/es-discuss/2012-June/023693.html

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]]('a').
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.

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


corrected in rev 11 editor's draft


in October 26, 2012 release draft