Arguments instantiation has no effect on June 15 draft

Yusuke Suzuki utatane.tea at gmail.com
Sun Jun 24 05:11:55 PDT 2012


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

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.

Regards,
Yusuke Suzuki
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120624/1d6796ce/attachment.html>


More information about the es-discuss mailing list