8.6 Miscellaneous
These operations are used in multiple places throughout the specification.
8.6.1 Runtime Semantics: InstantiateFunctionObject
The
- Return
InstantiateOrdinaryFunctionObject ofFunctionDeclaration with arguments env and privateEnv.
- Return
InstantiateGeneratorFunctionObject ofGeneratorDeclaration with arguments env and privateEnv.
- Return
InstantiateAsyncGeneratorFunctionObject ofAsyncGeneratorDeclaration with arguments env and privateEnv.
- Return
InstantiateAsyncFunctionObject ofAsyncFunctionDeclaration with arguments env and privateEnv.
8.6.2 Runtime Semantics: BindingInitialization
The
var
statements and formal parameter lists of some
It is defined piecewise over the following productions:
- Let name be
StringValue ofIdentifier . - Return ?
InitializeBoundName (name, value, environment).
- Return ?
InitializeBoundName ("yield" , value, environment).
- Return ?
InitializeBoundName ("await" , value, environment).
- Perform ?
RequireObjectCoercible (value). - Return ?
BindingInitialization ofObjectBindingPattern with arguments value and environment.
- Let iteratorRecord be ?
GetIterator (value,sync ). - Let result be
Completion (IteratorBindingInitialization ofArrayBindingPattern with arguments iteratorRecord and environment). - If iteratorRecord.[[Done]] is
false , return ?IteratorClose (iteratorRecord, result). - Return ? result.
- Return
unused .
- Perform ?
PropertyBindingInitialization ofBindingPropertyList with arguments value and environment. - Return
unused .
- Let excludedNames be a new empty
List . - Return ?
RestBindingInitialization ofBindingRestProperty with arguments value, environment, and excludedNames.
- Let excludedNames be ?
PropertyBindingInitialization ofBindingPropertyList with arguments value and environment. - Return ?
RestBindingInitialization ofBindingRestProperty with arguments value, environment, and excludedNames.
8.6.2.1 InitializeBoundName ( name, value, environment )
The abstract operation InitializeBoundName takes arguments name (a String), value (an
- If environment is not
undefined , then- Perform ! environment.InitializeBinding(name, value).
- Return
unused .
- Else,
- Let lhs be ?
ResolveBinding (name). - Return ?
PutValue (lhs, value).
- Let lhs be ?
8.6.3 Runtime Semantics: IteratorBindingInitialization
The
When
It is defined piecewise over the following productions:
- Return
unused .
- Return ?
IteratorDestructuringAssignmentEvaluation ofElision with argument iteratorRecord.
- If
Elision is present, then- Perform ?
IteratorDestructuringAssignmentEvaluation ofElision with argument iteratorRecord.
- Perform ?
- Return ?
IteratorBindingInitialization ofBindingRestElement with arguments iteratorRecord and environment.
- Perform ?
IteratorBindingInitialization ofBindingElementList with arguments iteratorRecord and environment. - Return ?
IteratorDestructuringAssignmentEvaluation ofElision with argument iteratorRecord.
- Perform ?
IteratorBindingInitialization ofBindingElementList with arguments iteratorRecord and environment. - If
Elision is present, then- Perform ?
IteratorDestructuringAssignmentEvaluation ofElision with argument iteratorRecord.
- Perform ?
- Return ?
IteratorBindingInitialization ofBindingRestElement with arguments iteratorRecord and environment.
- Perform ?
IteratorBindingInitialization ofBindingElementList with arguments iteratorRecord and environment. - Return ?
IteratorBindingInitialization ofBindingElisionElement with arguments iteratorRecord and environment.
- Perform ?
IteratorDestructuringAssignmentEvaluation ofElision with argument iteratorRecord. - Return ?
IteratorBindingInitialization ofBindingElement with arguments iteratorRecord and environment.
- Let bindingId be
StringValue ofBindingIdentifier . - Let lhs be ?
ResolveBinding (bindingId, environment). - Let v be
undefined . - If iteratorRecord.[[Done]] is
false , then- Let next be ?
IteratorStepValue (iteratorRecord). - If next is not
done , then- Set v to next.
- Let next be ?
- If
Initializer is present and v isundefined , then- If
IsAnonymousFunctionDefinition (Initializer ) istrue , then- Set v to ?
NamedEvaluation ofInitializer with argument bindingId.
- Set v to ?
- Else,
- Let defaultValue be ?
Evaluation ofInitializer . - Set v to ?
GetValue (defaultValue).
- Let defaultValue be ?
- If
- If environment is
undefined , return ?PutValue (lhs, v). - Return ?
InitializeReferencedBinding (lhs, v).
- Let v be
undefined . - If iteratorRecord.[[Done]] is
false , then- Let next be ?
IteratorStepValue (iteratorRecord). - If next is not
done , then- Set v to next.
- Let next be ?
- If
Initializer is present and v isundefined , then- Let defaultValue be ?
Evaluation ofInitializer . - Set v to ?
GetValue (defaultValue).
- Let defaultValue be ?
- Return ?
BindingInitialization ofBindingPattern with arguments v and environment.
- Let lhs be ?
ResolveBinding (StringValue ofBindingIdentifier , environment). - Let A be !
ArrayCreate (0). - Let n be 0.
- Repeat,
- Let next be
done . - If iteratorRecord.[[Done]] is
false , then- Set next to ?
IteratorStepValue (iteratorRecord).
- Set next to ?
- If next is
done , then- If environment is
undefined , return ?PutValue (lhs, A). - Return ?
InitializeReferencedBinding (lhs, A).
- If environment is
- Perform !
CreateDataPropertyOrThrow (A, !ToString (𝔽 (n)), next). - Set n to n + 1.
- Let next be
- Let A be !
ArrayCreate (0). - Let n be 0.
- Repeat,
- Let next be
done . - If iteratorRecord.[[Done]] is
false , then- Set next to ?
IteratorStepValue (iteratorRecord).
- Set next to ?
- If next is
done , then- Return ?
BindingInitialization ofBindingPattern with arguments A and environment.
- Return ?
- Perform !
CreateDataPropertyOrThrow (A, !ToString (𝔽 (n)), next). - Set n to n + 1.
- Let next be
- Return
unused .
- Perform ?
IteratorBindingInitialization ofFormalParameterList with arguments iteratorRecord and environment. - Return ?
IteratorBindingInitialization ofFunctionRestParameter with arguments iteratorRecord and environment.
- Perform ?
IteratorBindingInitialization ofFormalParameterList with arguments iteratorRecord and environment. - Return ?
IteratorBindingInitialization ofFormalParameter with arguments iteratorRecord and environment.
- Let v be
undefined . Assert : iteratorRecord.[[Done]] isfalse .- Let next be ?
IteratorStepValue (iteratorRecord). - If next is not
done , then- Set v to next.
- Return ?
BindingInitialization ofBindingIdentifier with arguments v and environment.
- Let formals be the
ArrowFormalParameters that iscovered byCoverParenthesizedExpressionAndArrowParameterList . - Return ?
IteratorBindingInitialization of formals with arguments iteratorRecord and environment.
- Let v be
undefined . Assert : iteratorRecord.[[Done]] isfalse .- Let next be ?
IteratorStepValue (iteratorRecord). - If next is not
done , then- Set v to next.
- Return ?
BindingInitialization ofBindingIdentifier with arguments v and environment.
8.6.4 Static Semantics: AssignmentTargetType
The
- If this
IdentifierReference is contained instrict mode code andStringValue ofIdentifier is either"eval" or"arguments" , returninvalid . - Return
simple .
- Return
simple .
- Let expr be the
ParenthesizedExpression that iscovered byCoverParenthesizedExpressionAndArrowParameterList . - Return
AssignmentTargetType of expr.
- Return
invalid .
8.6.5 Static Semantics: PropName
The
- Return
StringValue ofIdentifierReference .
- Return
empty .
- Return
PropName ofPropertyName .
- Return
StringValue ofIdentifierName .
- Return the
SV ofStringLiteral .
- Let nbr be the
NumericValue ofNumericLiteral . - Return !
ToString (nbr).
- Return
empty .
- Return
PropName ofClassElementName .
- Return
PropName ofClassElementName .
- Return
PropName ofClassElementName .
- Return
empty .
- Return
empty .
- Return
PropName ofClassElementName .
- Return
PropName ofClassElementName .
- Return
empty .