Skip to content

Commit

Permalink
Create a new DeclarativeEnvironment for the parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ajklein authored and syg committed Dec 11, 2019
1 parent 47b3013 commit 391182d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -8621,8 +8621,6 @@ <h1>FunctionDeclarationInstantiation ( _func_, _argumentsList_ )</h1>
-->
<emu-alg>
1. Let _calleeContext_ be the running execution context.
1. Let _env_ be the LexicalEnvironment of _calleeContext_.
1. Let _envRec_ be _env_'s EnvironmentRecord.
1. Let _code_ be _func_.[[ECMAScriptCode]].
1. Let _strict_ be _func_.[[Strict]].
1. Let _formals_ be _func_.[[FormalParameters]].
Expand Down Expand Up @@ -8652,6 +8650,15 @@ <h1>FunctionDeclarationInstantiation ( _func_, _argumentsList_ )</h1>
1. Else if _hasParameterExpressions_ is *false*, then
1. If *"arguments"* is an element of _functionNames_ or if *"arguments"* is an element of _lexicalNames_, then
1. Set _argumentsObjectNeeded_ to *false*.
1. If _strict_ is *true* or if _hasParameterExpressions_ is *false*, then
1. NOTE: Only a single lexical environment is needed for the parameters and top-level vars.
1. Let _env_ be the LexicalEnvironment of _calleeContext_.
1. Let _envRec_ be _env_'s EnvironmentRecord.
1. Else,
1. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared.
1. Let _calleeEnv_ be the LexicalEnvironment of _calleeContext_.
1. Let _env_ be NewDeclarativeEnvironment(_calleeEnv_).
1. Let _envRec_ be _env_'s EnvironmentRecord.
1. For each String _paramName_ in _parameterNames_, do
1. Let _alreadyDeclared_ be _envRec_.HasBinding(_paramName_).
1. NOTE: Early errors ensure that duplicate parameter names can only occur in non-strict functions that do not have parameter default values or rest parameters.
Expand Down

0 comments on commit 391182d

Please sign in to comment.