15.1 Parameter Lists

Syntax

UniqueFormalParameters[Yield, Await] : FormalParameters[?Yield, ?Await] FormalParameters[Yield, Await] : [empty] FunctionRestParameter[?Yield, ?Await] FormalParameterList[?Yield, ?Await] FormalParameterList[?Yield, ?Await] , FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] FormalParameterList[Yield, Await] : FormalParameter[?Yield, ?Await] FormalParameterList[?Yield, ?Await] , FormalParameter[?Yield, ?Await] FunctionRestParameter[Yield, Await] : BindingRestElement[?Yield, ?Await] FormalParameter[Yield, Await] : BindingElement[?Yield, ?Await]

15.1.1 Static Semantics: Early Errors

UniqueFormalParameters : FormalParameters FormalParameters : FormalParameterList Note

Multiple occurrences of the same BindingIdentifier in a FormalParameterList is only allowed for functions which have simple parameter lists and which are not defined in strict mode code.

15.1.2 Static Semantics: ContainsExpression

ObjectBindingPattern : { } { BindingRestProperty }
  1. Return false.
ObjectBindingPattern : { BindingPropertyList , BindingRestProperty }
  1. Return ContainsExpression of BindingPropertyList.
ArrayBindingPattern : [ Elisionopt ]
  1. Return false.
ArrayBindingPattern : [ Elisionopt BindingRestElement ]
  1. Return ContainsExpression of BindingRestElement.
ArrayBindingPattern : [ BindingElementList , Elisionopt ]
  1. Return ContainsExpression of BindingElementList.
ArrayBindingPattern : [ BindingElementList , Elisionopt BindingRestElement ]
  1. Let has be ContainsExpression of BindingElementList.
  2. If has is true, return true.
  3. Return ContainsExpression of BindingRestElement.
BindingPropertyList : BindingPropertyList , BindingProperty
  1. Let has be ContainsExpression of BindingPropertyList.
  2. If has is true, return true.
  3. Return ContainsExpression of BindingProperty.
BindingElementList : BindingElementList , BindingElisionElement
  1. Let has be ContainsExpression of BindingElementList.
  2. If has is true, return true.
  3. Return ContainsExpression of BindingElisionElement.
BindingElisionElement : Elisionopt BindingElement
  1. Return ContainsExpression of BindingElement.
BindingProperty : PropertyName : BindingElement
  1. Let has be IsComputedPropertyKey of PropertyName.
  2. If has is true, return true.
  3. Return ContainsExpression of BindingElement.
BindingElement : BindingPattern Initializer
  1. Return true.
SingleNameBinding : BindingIdentifier
  1. Return false.
SingleNameBinding : BindingIdentifier Initializer
  1. Return true.
BindingRestElement : ... BindingIdentifier
  1. Return false.
BindingRestElement : ... BindingPattern
  1. Return ContainsExpression of BindingPattern.
FormalParameters : [empty]
  1. Return false.
FormalParameters : FormalParameterList , FunctionRestParameter
  1. If ContainsExpression of FormalParameterList is true, return true.
  2. Return ContainsExpression of FunctionRestParameter.
FormalParameterList : FormalParameterList , FormalParameter
  1. If ContainsExpression of FormalParameterList is true, return true.
  2. Return ContainsExpression of FormalParameter.
ArrowParameters : BindingIdentifier
  1. Return false.
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
  1. Let formals be the ArrowFormalParameters that is covered by CoverParenthesizedExpressionAndArrowParameterList.
  2. Return ContainsExpression of formals.
AsyncArrowBindingIdentifier : BindingIdentifier
  1. Return false.

15.1.3 Static Semantics: IsSimpleParameterList

BindingElement : BindingPattern
  1. Return false.
BindingElement : BindingPattern Initializer
  1. Return false.
SingleNameBinding : BindingIdentifier
  1. Return true.
SingleNameBinding : BindingIdentifier Initializer
  1. Return false.
FormalParameters : [empty]
  1. Return true.
FormalParameters : FunctionRestParameter
  1. Return false.
FormalParameters : FormalParameterList , FunctionRestParameter
  1. Return false.
FormalParameterList : FormalParameterList , FormalParameter
  1. If IsSimpleParameterList of FormalParameterList is false, return false.
  2. Return IsSimpleParameterList of FormalParameter.
FormalParameter : BindingElement
  1. Return IsSimpleParameterList of BindingElement.
ArrowParameters : BindingIdentifier
  1. Return true.
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
  1. Let formals be the ArrowFormalParameters that is covered by CoverParenthesizedExpressionAndArrowParameterList.
  2. Return IsSimpleParameterList of formals.
AsyncArrowBindingIdentifier : BindingIdentifier
  1. Return true.
CoverCallExpressionAndAsyncArrowHead : MemberExpression Arguments
  1. Let head be the AsyncArrowHead that is covered by CoverCallExpressionAndAsyncArrowHead.
  2. Return IsSimpleParameterList of head.

15.1.4 Static Semantics: HasInitializer

BindingElement : BindingPattern
  1. Return false.
BindingElement : BindingPattern Initializer
  1. Return true.
SingleNameBinding : BindingIdentifier
  1. Return false.
SingleNameBinding : BindingIdentifier Initializer
  1. Return true.
FormalParameterList : FormalParameterList , FormalParameter
  1. If HasInitializer of FormalParameterList is true, return true.
  2. Return HasInitializer of FormalParameter.

15.1.5 Static Semantics: ExpectedArgumentCount

FormalParameters : [empty] FunctionRestParameter
  1. Return 0.
FormalParameters : FormalParameterList , FunctionRestParameter
  1. Return ExpectedArgumentCount of FormalParameterList.
Note

The ExpectedArgumentCount of a FormalParameterList is the number of FormalParameters to the left of either the rest parameter or the first FormalParameter with an Initializer. A FormalParameter without an initializer is allowed after the first parameter with an initializer but such parameters are considered to be optional with undefined as their default value.

FormalParameterList : FormalParameter
  1. If HasInitializer of FormalParameter is true, return 0.
  2. Return 1.
FormalParameterList : FormalParameterList , FormalParameter
  1. Let count be ExpectedArgumentCount of FormalParameterList.
  2. If HasInitializer of FormalParameterList is true or HasInitializer of FormalParameter is true, return count.
  3. Return count + 1.
ArrowParameters : BindingIdentifier
  1. Return 1.
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
  1. Let formals be the ArrowFormalParameters that is covered by CoverParenthesizedExpressionAndArrowParameterList.
  2. Return ExpectedArgumentCount of formals.
PropertySetParameterList : FormalParameter
  1. If HasInitializer of FormalParameter is true, return 0.
  2. Return 1.
AsyncArrowBindingIdentifier : BindingIdentifier
  1. Return 1.