Hello,

In the latest ES.next draft(May 4), section 10.5.3 Function Declaration
Instantiation step 5 is following

  5. For each String argName in parameterNames, in list order do
>     a. Let alreadyDeclared be the result of calling env’s HasBinding
> concrete method passing argName as the argument.
>     b. NOTE Duplicate parameter names can only occur in non-strict code.
>     c. If alreadyDeclared is false, then
>       i. Call env’s CreateMutableBinding concrete method passing argName
> as the argument.
>     d. If strict is false, then
>       i. Call env’s InitializeBinding concrete method passing argName, and
> undefined as the arguments.


In the step d-i, if strict is false, engine always call
env.InitializeBinding(argName, undefined).
But if code is non-strict mode, duplicate parameter names may be provided.

And section 10.2.1.1.8, InitializeBinding, step 2 is following

  2. Assert: envRec must have an uninitialised binding for N.


So for example,

  // this is non-strict function
  function test(a, a) {
  }
  test(1, 1);


engine execute above script and raise assertion failure because of calling
InitializeBinding to the same name twice.

So I suggest changing like this

    c. If alreadyDeclared is false, then
>       i. Call env’s CreateMutableBinding concrete method passing argName
> as the argument.
>       ii. If strict is false, then
>         1. Call env’s InitializeBinding concrete method passing argName,
> and undefined as the arguments.


If I missed something, please point out.

Regards,
Yusuke Suzuki
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to