diff --git a/spec.html b/spec.html index 0f7728b..76094d6 100644 --- a/spec.html +++ b/spec.html @@ -115,6 +115,21 @@

Tree Grammar

attribute boolean isCaptured; }; +interface AssertedPositionalParameterName { + attribute unsigned short index; + attribute IdentifierName name; + attribute boolean isCaptured; +}; + +interface AssertedParameterName { + attribute IdentifierName name; + attribute boolean isCaptured; +}; + +typedef (AssertedPositionalParameterName or + AssertedParameterName) + AssertedMaybePositionalParameterName; + interface AssertedBoundName { attribute IdentifierName name; attribute boolean isCaptured; @@ -136,9 +151,8 @@

Tree Grammar

}; interface AssertedParameterScope { - attribute FrozenArray<AssertedBoundName> boundNames; + attribute FrozenArray paramNames; attribute boolean hasDirectEval; - attribute boolean isSimpleParameterList; }; interface AssertedBoundNamesScope { @@ -2931,6 +2945,32 @@

CheckParameterNames ( _expectedParams0_, _actualParams_ )

+ +

CheckPositionalParameterIndices ( _expectedParams_, _positionalParamNames_ )

+ + 1. Let _paramIndices_ be CreatePositionalParameterIndices(_positionalParamNames_). + 1. For each _p_ in _expectedParams_, do + 1. If _p_ is an `AssertedPositionalParameterName`, then + 1. If _paramIndices_ contains an item _item_ where _item_.[[Name]] is _p_`.name` and _item_.[[Index]] is _p_`.index`, then + 1. Remove _item_ from _paramIndices_. + 1. Else, + 1. throw a *SyntaxError* exception. + 1. If _paramIndices_ is not empty, throw *SyntaxError* exception. + +
+ + +

CreatePositionalParameterIndices (_positionalParamNames_ )

+ + 1. Let _paramIndices_ be a new empty List. + 1. Let _idx_ be 0. + 1. For each _p_ in _positionalParamNames_ in List order, do + 1. If _p_ is not an empty string, then + 1. Append Record {[[Name]]: _p_, [[Index]]: _idx_} to _paramIndices_. + 1. Return _paramIndices_. + +
+

CheckBoundNames ( _expectedBound_, _actualBound_ )

@@ -2966,8 +3006,9 @@

CheckAssertedScope ( _scope_ , _parseTree_ )

1. Else if _scope_ is an `AssertedParameterScope`, then 1. NOTE: The positions as well as the names of parameters must match. 1. Let _paramNames_ be the BoundNames of _parseTree_. - 1. Perform ? CheckParameterNames(_scope_`.boundNames`, _boundNames_). - 1. If _scope_`.isSimpleParameterList` is not the same value as IsSimpleParameterList of _parseTree_, then throw a *SyntaxError* exception. + 1. Perform ? CheckParameterNames(_scope_`.paramNames`, _paramNames_). + 1. Let _positionalParamNames_ be the PositionalParameterNames of _parseTree_. + 1. Perform ? CheckPositionalParameterIndices(_scope_`.paramNames`, _positionalParamNames_). 1. Else, 1. Let _boundNames_ be the BoundNames of _parseTree_. 1. Perform ? CheckBoundNames(_scope_`.boundNames`, _boundNames_). @@ -2981,6 +3022,8 @@

CheckAssertedScope ( _scope_ , _parseTree_ )

1. Let _enclosingScope_ be _scopeNode_.[[Enclosing]].[[AssertedScope]]. 1. If _scope_ is an `AssertedBlockScope` or an `AssertedScriptGlobalScope` or an `AssertedVarScope`, then 1. Let _enclosingDeclaredOrBoundNames_ be _enclosingScope_`.declaredNames`. + 1. Else if _scope_ is an `AssertedParameterScope`, then, + 1. Let _enclosingDeclaredOrBoundNames_ be _enclosingScope_`.paramNames`. 1. Else, 1. Let _enclosingDeclaredOrBoundNames_ be _enclosingScope_`.boundNames`. 1. For each _d_ in _enclosingDeclaredOrBoundNames_, do @@ -3211,6 +3254,75 @@

Static Semantics: HasFreeThis

1. Return *false*.
+ + +

Static Semantics: PositionalParameterNames

+ +

Collect the positional formal parameter names.

+

With parameters _formalParameters_.

+ + FormalParameters : [empty] + + 1. Return a new empty List. + + + FormalParameters : FunctionRestParameter + + 1. Return a new empty List. + + + FormalParameters : FormalParameterList + + 1. Return the PositionalParameterNames of |FormalParameterList|. + + + FormalParameters : FormalParameterList, + + 1. Return the PositionalParameterNames of |FormalParameterList|. + + + FormalParameters : FormalParameterList, FunctionRestParameter + + 1. Return the PositionalParameterNames of |FormalParameterList|. + + + FormalParameterList : FormalParameter + + 1. Return the PositionalParameterNames of |FormalParameter|. + + + FormalParameterList : FormalParameterList, FormalParameter + + 1. Let _params_ be PositionalParameterNames of |FormalParameterList|. + 1. Append to _params_ the PositionalParameterNames of |FormalParameter|. + 1. Return _params_ + + + FormalParameter : BindingIdentifier Initializer_opt + + 1. Return the PositionalParameterNames of |BindingIdentifier|. + + + FormalParameter : Identifier + + 1. Return a new List containing the StringValue of |Identifier|. + + + FormalParameter : `yield` + + 1. Return a new List containing `"yield"`. + + + FormalParameter : `await` + + 1. Return a new List containing `"await"`. + + + FormalParameter : BindingPattern Initializer_opt + + 1. Return a new List containing an empty string. + +