8 Syntax-Directed Operations
In addition to those defined in this section, specialized
8.1 Runtime Semantics: Evaluation
The
8.2 Scope Analysis
8.2.1 Static Semantics: BoundNames
The
It is defined piecewise over the following productions:
- Return a
List whose sole element is theStringValue ofIdentifier .
- Return «
"yield" ».
- Return «
"await" ».
- Return the BoundNames of
BindingList .
- Let names1 be the BoundNames of
BindingList . - Let names2 be the BoundNames of
LexicalBinding . - Return the
list-concatenation of names1 and names2.
- Return the BoundNames of
BindingIdentifier .
- Return the BoundNames of
BindingPattern .
- Let names1 be the BoundNames of
VariableDeclarationList . - Let names2 be the BoundNames of
VariableDeclaration . - Return the
list-concatenation of names1 and names2.
- Return the BoundNames of
BindingIdentifier .
- Return the BoundNames of
BindingPattern .
- Return a new empty
List .
- Let names1 be the BoundNames of
BindingPropertyList . - Let names2 be the BoundNames of
BindingRestProperty . - Return the
list-concatenation of names1 and names2.
- Return a new empty
List .
- Return the BoundNames of
BindingRestElement .
- Return the BoundNames of
BindingElementList .
- Let names1 be the BoundNames of
BindingElementList . - Let names2 be the BoundNames of
BindingRestElement . - Return the
list-concatenation of names1 and names2.
- Let names1 be the BoundNames of
BindingPropertyList . - Let names2 be the BoundNames of
BindingProperty . - Return the
list-concatenation of names1 and names2.
- Let names1 be the BoundNames of
BindingElementList . - Let names2 be the BoundNames of
BindingElisionElement . - Return the
list-concatenation of names1 and names2.
- Return the BoundNames of
BindingElement .
- Return the BoundNames of
BindingElement .
- Return the BoundNames of
BindingIdentifier .
- Return the BoundNames of
BindingPattern .
- Return the BoundNames of
ForBinding .
- Return the BoundNames of
BindingIdentifier .
- Return «
"*default*" ».
- Return a new empty
List .
- Let names1 be the BoundNames of
FormalParameterList . - Let names2 be the BoundNames of
FunctionRestParameter . - Return the
list-concatenation of names1 and names2.
- Let names1 be the BoundNames of
FormalParameterList . - Let names2 be the BoundNames of
FormalParameter . - Return the
list-concatenation of names1 and names2.
- Let formals be the
ArrowFormalParameters that iscovered byCoverParenthesizedExpressionAndArrowParameterList . - Return the BoundNames of formals.
- Return the BoundNames of
BindingIdentifier .
- Return «
"*default*" ».
- Return the BoundNames of
BindingIdentifier .
- Return «
"*default*" ».
- Return the BoundNames of
BindingIdentifier .
- Return «
"*default*" ».
- Return the BoundNames of
BindingIdentifier .
- Return «
"*default*" ».
- Let head be the
AsyncArrowHead that iscovered byCoverCallExpressionAndAsyncArrowHead . - Return the BoundNames of head.
- Return the BoundNames of
ImportClause .
- Return a new empty
List .
- Let names1 be the BoundNames of
ImportedDefaultBinding . - Let names2 be the BoundNames of
NameSpaceImport . - Return the
list-concatenation of names1 and names2.
- Let names1 be the BoundNames of
ImportedDefaultBinding . - Let names2 be the BoundNames of
NamedImports . - Return the
list-concatenation of names1 and names2.
- Return a new empty
List .
- Let names1 be the BoundNames of
ImportsList . - Let names2 be the BoundNames of
ImportSpecifier . - Return the
list-concatenation of names1 and names2.
- Return the BoundNames of
ImportedBinding .
- Return a new empty
List .
- Return the BoundNames of
VariableStatement .
- Return the BoundNames of
Declaration .
- Let declarationNames be the BoundNames of
HoistableDeclaration . - If declarationNames does not include the element
"*default*" , append"*default*" to declarationNames. - Return declarationNames.
- Let declarationNames be the BoundNames of
ClassDeclaration . - If declarationNames does not include the element
"*default*" , append"*default*" to declarationNames. - Return declarationNames.
- Return «
"*default*" ».
8.2.2 Static Semantics: DeclarationPart
The
- Return
FunctionDeclaration .
- Return
GeneratorDeclaration .
- Return
AsyncFunctionDeclaration .
- Return
AsyncGeneratorDeclaration .
- Return
ClassDeclaration .
- Return
LexicalDeclaration .
8.2.3 Static Semantics: IsConstantDeclaration
The
- Return IsConstantDeclaration of
LetOrConst .
- Return
false .
- Return
true .
- Return
false .
- Return
false .
- Return
false .
It is not necessary to treat export default
8.2.4 Static Semantics: LexicallyDeclaredNames
The
- Return a new empty
List .
- Let names1 be the LexicallyDeclaredNames of
StatementList . - Let names2 be the LexicallyDeclaredNames of
StatementListItem . - Return the
list-concatenation of names1 and names2.
- If
Statement is , return the LexicallyDeclaredNames ofStatement : LabelledStatement LabelledStatement . - Return a new empty
List .
- Return the
BoundNames ofDeclaration .
- Return a new empty
List .
- If the first
CaseClauses is present, let names1 be the LexicallyDeclaredNames of the firstCaseClauses . - Else, let names1 be a new empty
List . - Let names2 be the LexicallyDeclaredNames of
DefaultClause . - If the second
CaseClauses is present, let names3 be the LexicallyDeclaredNames of the secondCaseClauses . - Else, let names3 be a new empty
List . - Return the
list-concatenation of names1, names2, and names3.
- Let names1 be the LexicallyDeclaredNames of
CaseClauses . - Let names2 be the LexicallyDeclaredNames of
CaseClause . - Return the
list-concatenation of names1 and names2.
- If the
StatementList is present, return the LexicallyDeclaredNames ofStatementList . - Return a new empty
List .
- If the
StatementList is present, return the LexicallyDeclaredNames ofStatementList . - Return a new empty
List .
- Return the LexicallyDeclaredNames of
LabelledItem .
- Return a new empty
List .
- Return the
BoundNames ofFunctionDeclaration .
- Return a new empty
List .
- Return the
TopLevelLexicallyDeclaredNames ofStatementList .
- Return a new empty
List .
- Return the
TopLevelLexicallyDeclaredNames ofStatementList .
- Return a new empty
List .
- Return a new empty
List .
- Return a new empty
List .
- Return the
TopLevelLexicallyDeclaredNames ofStatementList .
At the top level of a
The LexicallyDeclaredNames of a
- Let names1 be the LexicallyDeclaredNames of
ModuleItemList . - Let names2 be the LexicallyDeclaredNames of
ModuleItem . - Return the
list-concatenation of names1 and names2.
- Return the
BoundNames ofImportDeclaration .
- If
ExportDeclaration isexportVariableStatement , return a new emptyList . - Return the
BoundNames ofExportDeclaration .
- Return the LexicallyDeclaredNames of
StatementListItem .
At the top level of a
8.2.5 Static Semantics: LexicallyScopedDeclarations
The
- Let declarations1 be the LexicallyScopedDeclarations of
StatementList . - Let declarations2 be the LexicallyScopedDeclarations of
StatementListItem . - Return the
list-concatenation of declarations1 and declarations2.
- If
Statement is , return the LexicallyScopedDeclarations ofStatement : LabelledStatement LabelledStatement . - Return a new empty
List .
- Return a
List whose sole element is theDeclarationPart ofDeclaration .
- Return a new empty
List .
- If the first
CaseClauses is present, let declarations1 be the LexicallyScopedDeclarations of the firstCaseClauses . - Else, let declarations1 be a new empty
List . - Let declarations2 be the LexicallyScopedDeclarations of
DefaultClause . - If the second
CaseClauses is present, let declarations3 be the LexicallyScopedDeclarations of the secondCaseClauses . - Else, let declarations3 be a new empty
List . - Return the
list-concatenation of declarations1, declarations2, and declarations3.
- Let declarations1 be the LexicallyScopedDeclarations of
CaseClauses . - Let declarations2 be the LexicallyScopedDeclarations of
CaseClause . - Return the
list-concatenation of declarations1 and declarations2.
- If the
StatementList is present, return the LexicallyScopedDeclarations ofStatementList . - Return a new empty
List .
- If the
StatementList is present, return the LexicallyScopedDeclarations ofStatementList . - Return a new empty
List .
- Return the LexicallyScopedDeclarations of
LabelledItem .
- Return a new empty
List .
- Return «
FunctionDeclaration ».
- Return a new empty
List .
- Return the
TopLevelLexicallyScopedDeclarations ofStatementList .
- Return a new empty
List .
- Return the
TopLevelLexicallyScopedDeclarations ofStatementList .
- Return a new empty
List .
- Return a new empty
List .
- Return a new empty
List .
- Return the
TopLevelLexicallyScopedDeclarations ofStatementList .
- Return a new empty
List .
- Let declarations1 be the LexicallyScopedDeclarations of
ModuleItemList . - Let declarations2 be the LexicallyScopedDeclarations of
ModuleItem . - Return the
list-concatenation of declarations1 and declarations2.
- Return a new empty
List .
- Return a new empty
List .
- Return a
List whose sole element is theDeclarationPart ofDeclaration .
- Return a
List whose sole element is theDeclarationPart ofHoistableDeclaration .
- Return a
List whose sole element isClassDeclaration .
- Return a
List whose sole element is thisExportDeclaration .
8.2.6 Static Semantics: VarDeclaredNames
The
- Return a new empty
List .
- Return a new empty
List .
- Let names1 be the VarDeclaredNames of
StatementList . - Let names2 be the VarDeclaredNames of
StatementListItem . - Return the
list-concatenation of names1 and names2.
- Return a new empty
List .
- Return the
BoundNames ofVariableDeclarationList .
- Let names1 be the VarDeclaredNames of the first
Statement . - Let names2 be the VarDeclaredNames of the second
Statement . - Return the
list-concatenation of names1 and names2.
- Return the VarDeclaredNames of
Statement .
- Return the VarDeclaredNames of
Statement .
- Return the VarDeclaredNames of
Statement .
- Return the VarDeclaredNames of
Statement .
- Let names1 be the
BoundNames ofVariableDeclarationList . - Let names2 be the VarDeclaredNames of
Statement . - Return the
list-concatenation of names1 and names2.
- Return the VarDeclaredNames of
Statement .
- Return the VarDeclaredNames of
Statement .
- Let names1 be the
BoundNames ofForBinding . - Let names2 be the VarDeclaredNames of
Statement . - Return the
list-concatenation of names1 and names2.
This section is extended by Annex
- Return the VarDeclaredNames of
Statement .
- Return the VarDeclaredNames of
CaseBlock .
- Return a new empty
List .
- If the first
CaseClauses is present, let names1 be the VarDeclaredNames of the firstCaseClauses . - Else, let names1 be a new empty
List . - Let names2 be the VarDeclaredNames of
DefaultClause . - If the second
CaseClauses is present, let names3 be the VarDeclaredNames of the secondCaseClauses . - Else, let names3 be a new empty
List . - Return the
list-concatenation of names1, names2, and names3.
- Let names1 be the VarDeclaredNames of
CaseClauses . - Let names2 be the VarDeclaredNames of
CaseClause . - Return the
list-concatenation of names1 and names2.
- If the
StatementList is present, return the VarDeclaredNames ofStatementList . - Return a new empty
List .
- If the
StatementList is present, return the VarDeclaredNames ofStatementList . - Return a new empty
List .
- Return the VarDeclaredNames of
LabelledItem .
- Return a new empty
List .
- Let names1 be the VarDeclaredNames of
Block . - Let names2 be the VarDeclaredNames of
Catch . - Return the
list-concatenation of names1 and names2.
- Let names1 be the VarDeclaredNames of
Block . - Let names2 be the VarDeclaredNames of
Finally . - Return the
list-concatenation of names1 and names2.
- Let names1 be the VarDeclaredNames of
Block . - Let names2 be the VarDeclaredNames of
Catch . - Let names3 be the VarDeclaredNames of
Finally . - Return the
list-concatenation of names1, names2, and names3.
- Return the VarDeclaredNames of
Block .
- Return a new empty
List .
- Return the
TopLevelVarDeclaredNames ofStatementList .
- Return a new empty
List .
- Return the
TopLevelVarDeclaredNames ofStatementList .
- Return a new empty
List .
- Return a new empty
List .
- Return a new empty
List .
- Return the
TopLevelVarDeclaredNames ofStatementList .
- Let names1 be the VarDeclaredNames of
ModuleItemList . - Let names2 be the VarDeclaredNames of
ModuleItem . - Return the
list-concatenation of names1 and names2.
- Return a new empty
List .
- If
ExportDeclaration isexportVariableStatement , return theBoundNames ofExportDeclaration . - Return a new empty
List .
8.2.7 Static Semantics: VarScopedDeclarations
The
- Return a new empty
List .
- Return a new empty
List .
- Let declarations1 be the VarScopedDeclarations of
StatementList . - Let declarations2 be the VarScopedDeclarations of
StatementListItem . - Return the
list-concatenation of declarations1 and declarations2.
- Return a new empty
List .
- Return «
VariableDeclaration ».
- Let declarations1 be the VarScopedDeclarations of
VariableDeclarationList . - Return the
list-concatenation of declarations1 and «VariableDeclaration ».
- Let declarations1 be the VarScopedDeclarations of the first
Statement . - Let declarations2 be the VarScopedDeclarations of the second
Statement . - Return the
list-concatenation of declarations1 and declarations2.
- Return the VarScopedDeclarations of
Statement .
- Return the VarScopedDeclarations of
Statement .
- Return the VarScopedDeclarations of
Statement .
- Return the VarScopedDeclarations of
Statement .
- Let declarations1 be the VarScopedDeclarations of
VariableDeclarationList . - Let declarations2 be the VarScopedDeclarations of
Statement . - Return the
list-concatenation of declarations1 and declarations2.
- Return the VarScopedDeclarations of
Statement .
- Return the VarScopedDeclarations of
Statement .
- Let declarations1 be «
ForBinding ». - Let declarations2 be the VarScopedDeclarations of
Statement . - Return the
list-concatenation of declarations1 and declarations2.
This section is extended by Annex
- Return the VarScopedDeclarations of
Statement .
- Return the VarScopedDeclarations of
CaseBlock .
- Return a new empty
List .
- If the first
CaseClauses is present, let declarations1 be the VarScopedDeclarations of the firstCaseClauses . - Else, let declarations1 be a new empty
List . - Let declarations2 be the VarScopedDeclarations of
DefaultClause . - If the second
CaseClauses is present, let declarations3 be the VarScopedDeclarations of the secondCaseClauses . - Else, let declarations3 be a new empty
List . - Return the
list-concatenation of declarations1, declarations2, and declarations3.
- Let declarations1 be the VarScopedDeclarations of
CaseClauses . - Let declarations2 be the VarScopedDeclarations of
CaseClause . - Return the
list-concatenation of declarations1 and declarations2.
- If the
StatementList is present, return the VarScopedDeclarations ofStatementList . - Return a new empty
List .
- If the
StatementList is present, return the VarScopedDeclarations ofStatementList . - Return a new empty
List .
- Return the VarScopedDeclarations of
LabelledItem .
- Return a new empty
List .
- Let declarations1 be the VarScopedDeclarations of
Block . - Let declarations2 be the VarScopedDeclarations of
Catch . - Return the
list-concatenation of declarations1 and declarations2.
- Let declarations1 be the VarScopedDeclarations of
Block . - Let declarations2 be the VarScopedDeclarations of
Finally . - Return the
list-concatenation of declarations1 and declarations2.
- Let declarations1 be the VarScopedDeclarations of
Block . - Let declarations2 be the VarScopedDeclarations of
Catch . - Let declarations3 be the VarScopedDeclarations of
Finally . - Return the
list-concatenation of declarations1, declarations2, and declarations3.
- Return the VarScopedDeclarations of
Block .
- Return a new empty
List .
- Return the
TopLevelVarScopedDeclarations ofStatementList .
- Return a new empty
List .
- Return the
TopLevelVarScopedDeclarations ofStatementList .
- Return a new empty
List .
- Return a new empty
List .
- Return a new empty
List .
- Return the
TopLevelVarScopedDeclarations ofStatementList .
- Return a new empty
List .
- Let declarations1 be the VarScopedDeclarations of
ModuleItemList . - Let declarations2 be the VarScopedDeclarations of
ModuleItem . - Return the
list-concatenation of declarations1 and declarations2.
- Return a new empty
List .
- If
ExportDeclaration isexportVariableStatement , return the VarScopedDeclarations ofVariableStatement . - Return a new empty
List .
8.2.8 Static Semantics: TopLevelLexicallyDeclaredNames
The
- Let names1 be the TopLevelLexicallyDeclaredNames of
StatementList . - Let names2 be the TopLevelLexicallyDeclaredNames of
StatementListItem . - Return the
list-concatenation of names1 and names2.
- Return a new empty
List .
- If
Declaration is , thenDeclaration : HoistableDeclaration - Return a new empty
List .
- Return a new empty
- Return the
BoundNames ofDeclaration .
At the top level of a function, or script, function declarations are treated like var declarations rather than like lexical declarations.
8.2.9 Static Semantics: TopLevelLexicallyScopedDeclarations
The
- Let declarations1 be the TopLevelLexicallyScopedDeclarations of
StatementList . - Let declarations2 be the TopLevelLexicallyScopedDeclarations of
StatementListItem . - Return the
list-concatenation of declarations1 and declarations2.
- Return a new empty
List .
- If
Declaration is , thenDeclaration : HoistableDeclaration - Return a new empty
List .
- Return a new empty
- Return «
Declaration ».
8.2.10 Static Semantics: TopLevelVarDeclaredNames
The
- Let names1 be the TopLevelVarDeclaredNames of
StatementList . - Let names2 be the TopLevelVarDeclaredNames of
StatementListItem . - Return the
list-concatenation of names1 and names2.
- If
Declaration is , thenDeclaration : HoistableDeclaration - Return the
BoundNames ofHoistableDeclaration .
- Return the
- Return a new empty
List .
- If
Statement is , return the TopLevelVarDeclaredNames ofStatement : LabelledStatement Statement . - Return the
VarDeclaredNames ofStatement .
At the top level of a function or script, inner function declarations are treated like var declarations.
- Return the TopLevelVarDeclaredNames of
LabelledItem .
- If
Statement is , return the TopLevelVarDeclaredNames ofStatement : LabelledStatement Statement . - Return the
VarDeclaredNames ofStatement .
- Return the
BoundNames ofFunctionDeclaration .
8.2.11 Static Semantics: TopLevelVarScopedDeclarations
The
- Let declarations1 be the TopLevelVarScopedDeclarations of
StatementList . - Let declarations2 be the TopLevelVarScopedDeclarations of
StatementListItem . - Return the
list-concatenation of declarations1 and declarations2.
- If
Statement is , return the TopLevelVarScopedDeclarations ofStatement : LabelledStatement Statement . - Return the
VarScopedDeclarations ofStatement .
- If
Declaration is , thenDeclaration : HoistableDeclaration - Let declaration be the
DeclarationPart ofHoistableDeclaration . - Return « declaration ».
- Let declaration be the
- Return a new empty
List .
- Return the TopLevelVarScopedDeclarations of
LabelledItem .
- If
Statement is , return the TopLevelVarScopedDeclarations ofStatement : LabelledStatement Statement . - Return the
VarScopedDeclarations ofStatement .
- Return «
FunctionDeclaration ».
8.3 Labels
8.3.1 Static Semantics: ContainsDuplicateLabels
The
- Return
false .
- Let hasDuplicates be ContainsDuplicateLabels of
StatementList with argument labelSet. - If hasDuplicates is
true , returntrue . - Return ContainsDuplicateLabels of
StatementListItem with argument labelSet.
- Return ContainsDuplicateLabels of
Statement with argument labelSet.
- Return ContainsDuplicateLabels of
Statement with argument labelSet.
- Return ContainsDuplicateLabels of
Statement with argument labelSet.
- Return ContainsDuplicateLabels of
Statement with argument labelSet.
- Return ContainsDuplicateLabels of
Statement with argument labelSet.
This section is extended by Annex
- Return ContainsDuplicateLabels of
Statement with argument labelSet.
- Return ContainsDuplicateLabels of
CaseBlock with argument labelSet.
- Return
false .
- If the first
CaseClauses is present, then- If ContainsDuplicateLabels of the first
CaseClauses with argument labelSet istrue , returntrue .
- If ContainsDuplicateLabels of the first
- If ContainsDuplicateLabels of
DefaultClause with argument labelSet istrue , returntrue . - If the second
CaseClauses is not present, returnfalse . - Return ContainsDuplicateLabels of the second
CaseClauses with argument labelSet.
- Let hasDuplicates be ContainsDuplicateLabels of
CaseClauses with argument labelSet. - If hasDuplicates is
true , returntrue . - Return ContainsDuplicateLabels of
CaseClause with argument labelSet.
- If the
StatementList is present, return ContainsDuplicateLabels ofStatementList with argument labelSet. - Return
false .
- If the
StatementList is present, return ContainsDuplicateLabels ofStatementList with argument labelSet. - Return
false .
- Let label be the
StringValue ofLabelIdentifier . - If labelSet contains label, return
true . - Let newLabelSet be the
list-concatenation of labelSet and « label ». - Return ContainsDuplicateLabels of
LabelledItem with argument newLabelSet.
- Return
false .
- Return ContainsDuplicateLabels of
Block with argument labelSet.
- Return
false .
- Return
false .
- Let hasDuplicates be ContainsDuplicateLabels of
ModuleItemList with argument labelSet. - If hasDuplicates is
true , returntrue . - Return ContainsDuplicateLabels of
ModuleItem with argument labelSet.
- Return
false .
8.3.2 Static Semantics: ContainsUndefinedBreakTarget
The
- Return
false .
- Let hasUndefinedLabels be ContainsUndefinedBreakTarget of
StatementList with argument labelSet. - If hasUndefinedLabels is
true , returntrue . - Return ContainsUndefinedBreakTarget of
StatementListItem with argument labelSet.
- Return ContainsUndefinedBreakTarget of
Statement with argument labelSet.
- Return ContainsUndefinedBreakTarget of
Statement with argument labelSet.
- Return ContainsUndefinedBreakTarget of
Statement with argument labelSet.
- Return ContainsUndefinedBreakTarget of
Statement with argument labelSet.
- Return ContainsUndefinedBreakTarget of
Statement with argument labelSet.
This section is extended by Annex
- Return
false .
- If labelSet does not contain the
StringValue ofLabelIdentifier , returntrue . - Return
false .
- Return ContainsUndefinedBreakTarget of
Statement with argument labelSet.
- Return ContainsUndefinedBreakTarget of
CaseBlock with argument labelSet.
- Return
false .
- If the first
CaseClauses is present, then- If ContainsUndefinedBreakTarget of the first
CaseClauses with argument labelSet istrue , returntrue .
- If ContainsUndefinedBreakTarget of the first
- If ContainsUndefinedBreakTarget of
DefaultClause with argument labelSet istrue , returntrue . - If the second
CaseClauses is not present, returnfalse . - Return ContainsUndefinedBreakTarget of the second
CaseClauses with argument labelSet.
- Let hasUndefinedLabels be ContainsUndefinedBreakTarget of
CaseClauses with argument labelSet. - If hasUndefinedLabels is
true , returntrue . - Return ContainsUndefinedBreakTarget of
CaseClause with argument labelSet.
- If the
StatementList is present, return ContainsUndefinedBreakTarget ofStatementList with argument labelSet. - Return
false .
- If the
StatementList is present, return ContainsUndefinedBreakTarget ofStatementList with argument labelSet. - Return
false .
- Let label be the
StringValue ofLabelIdentifier . - Let newLabelSet be the
list-concatenation of labelSet and « label ». - Return ContainsUndefinedBreakTarget of
LabelledItem with argument newLabelSet.
- Return
false .
- Return ContainsUndefinedBreakTarget of
Block with argument labelSet.
- Return
false .
- Return
false .
- Let hasUndefinedLabels be ContainsUndefinedBreakTarget of
ModuleItemList with argument labelSet. - If hasUndefinedLabels is
true , returntrue . - Return ContainsUndefinedBreakTarget of
ModuleItem with argument labelSet.
- Return
false .
8.3.3 Static Semantics: ContainsUndefinedContinueTarget
The
- Return
false .
- Return ContainsUndefinedContinueTarget of
BlockStatement with arguments iterationSet and « ».
- Let newIterationSet be the
list-concatenation of iterationSet and labelSet. - Return ContainsUndefinedContinueTarget of
IterationStatement with arguments newIterationSet and « ».
- Let hasUndefinedLabels be ContainsUndefinedContinueTarget of
StatementList with arguments iterationSet and « ». - If hasUndefinedLabels is
true , returntrue . - Return ContainsUndefinedContinueTarget of
StatementListItem with arguments iterationSet and « ».
- Return ContainsUndefinedContinueTarget of
Statement with arguments iterationSet and « ».
- Return ContainsUndefinedContinueTarget of
Statement with arguments iterationSet and « ».
- Return ContainsUndefinedContinueTarget of
Statement with arguments iterationSet and « ».
- Return ContainsUndefinedContinueTarget of
Statement with arguments iterationSet and « ».
- Return ContainsUndefinedContinueTarget of
Statement with arguments iterationSet and « ».
This section is extended by Annex
- Return
false .
- If iterationSet does not contain the
StringValue ofLabelIdentifier , returntrue . - Return
false .
- Return ContainsUndefinedContinueTarget of
Statement with arguments iterationSet and « ».
- Return ContainsUndefinedContinueTarget of
CaseBlock with arguments iterationSet and « ».
- Return
false .
- If the first
CaseClauses is present, then- If ContainsUndefinedContinueTarget of the first
CaseClauses with arguments iterationSet and « » istrue , returntrue .
- If ContainsUndefinedContinueTarget of the first
- If ContainsUndefinedContinueTarget of
DefaultClause with arguments iterationSet and « » istrue , returntrue . - If the second
CaseClauses is not present, returnfalse . - Return ContainsUndefinedContinueTarget of the second
CaseClauses with arguments iterationSet and « ».
- Let hasUndefinedLabels be ContainsUndefinedContinueTarget of
CaseClauses with arguments iterationSet and « ». - If hasUndefinedLabels is
true , returntrue . - Return ContainsUndefinedContinueTarget of
CaseClause with arguments iterationSet and « ».
- If the
StatementList is present, return ContainsUndefinedContinueTarget ofStatementList with arguments iterationSet and « ». - Return
false .
- If the
StatementList is present, return ContainsUndefinedContinueTarget ofStatementList with arguments iterationSet and « ». - Return
false .
- Let label be the
StringValue ofLabelIdentifier . - Let newLabelSet be the
list-concatenation of labelSet and « label ». - Return ContainsUndefinedContinueTarget of
LabelledItem with arguments iterationSet and newLabelSet.
- Return
false .
- Return ContainsUndefinedContinueTarget of
Block with arguments iterationSet and « ».
- Return
false .
- Return
false .
- Let hasUndefinedLabels be ContainsUndefinedContinueTarget of
ModuleItemList with arguments iterationSet and « ». - If hasUndefinedLabels is
true , returntrue . - Return ContainsUndefinedContinueTarget of
ModuleItem with arguments iterationSet and « ».
- Return
false .
8.4 Function Name Inference
8.4.1 Static Semantics: HasName
The
- Let expr be the
ParenthesizedExpression that iscovered byCoverParenthesizedExpressionAndArrowParameterList . - If
IsFunctionDefinition of expr isfalse , returnfalse . - Return HasName of expr.
- Return
false .
- Return
true .
8.4.2 Static Semantics: IsFunctionDefinition
The
- Let expr be the
ParenthesizedExpression that iscovered byCoverParenthesizedExpressionAndArrowParameterList . - Return IsFunctionDefinition of expr.
- Return
false .
- Return
true .
8.4.3 Static Semantics: IsAnonymousFunctionDefinition ( expr )
The abstract operation IsAnonymousFunctionDefinition takes argument expr (an
- If
IsFunctionDefinition of expr isfalse , returnfalse . - Let hasName be
HasName of expr. - If hasName is
true , returnfalse . - Return
true .
8.4.4 Static Semantics: IsIdentifierRef
The
- Return
true .
- Return
false .
8.4.5 Runtime Semantics: NamedEvaluation
The
- Let expr be the
ParenthesizedExpression that iscovered byCoverParenthesizedExpressionAndArrowParameterList . - Return ? NamedEvaluation of expr with argument name.
Assert :IsAnonymousFunctionDefinition (Expression ) istrue .- Return ? NamedEvaluation of
Expression with argument name.
- Return
InstantiateOrdinaryFunctionExpression ofFunctionExpression with argument name.
- Return
InstantiateGeneratorFunctionExpression ofGeneratorExpression with argument name.
- Return
InstantiateAsyncGeneratorFunctionExpression ofAsyncGeneratorExpression with argument name.
- Return
InstantiateAsyncFunctionExpression ofAsyncFunctionExpression with argument name.
- Return
InstantiateArrowFunctionExpression ofArrowFunction with argument name.
- Return
InstantiateAsyncArrowFunctionExpression ofAsyncArrowFunction with argument name.
- Let value be ?
ClassDefinitionEvaluation ofClassTail with argumentsundefined and name. - Set value.[[SourceText]] to the
source text matched by ClassExpression . - Return value.
8.5 Contains
8.5.1 Static Semantics: Contains
The
Every grammar production alternative in this specification which is not listed below implicitly has the following default definition of Contains:
- For each child node child of this
Parse Node , do- If child is an instance of symbol, return
true . - If child is an instance of a nonterminal, then
- Let contained be the result of child Contains symbol.
- If contained is
true , returntrue .
- If child is an instance of symbol, return
- Return
false .
- Return
false .
Static semantic rules that depend upon substructure generally do not look into function definitions.
- If symbol is
ClassBody , returntrue . - If symbol is
ClassHeritage , then- If
ClassHeritage is present, returntrue ; otherwise returnfalse .
- If
- If
ClassHeritage is present, then- If
ClassHeritage Contains symbol istrue , returntrue .
- If
- Return the result of
ComputedPropertyContains ofClassBody with argument symbol.
Static semantic rules that depend upon substructure generally do not look into class bodies except for
- Return
false .
Static semantic rules that depend upon substructure generally do not look into static initialization blocks.
- If symbol is not one of
NewTarget ,SuperProperty ,SuperCall ,super, orthis, returnfalse . - If
ArrowParameters Contains symbol istrue , returntrue . - Return
ConciseBody Contains symbol.
- Let formals be the
ArrowFormalParameters that iscovered byCoverParenthesizedExpressionAndArrowParameterList . - Return formals Contains symbol.
- If symbol is not one of
NewTarget ,SuperProperty ,SuperCall ,super, orthis, returnfalse . - Return
AsyncConciseBody Contains symbol.
- If symbol is not one of
NewTarget ,SuperProperty ,SuperCall ,super, orthis, returnfalse . - Let head be the
AsyncArrowHead that iscovered byCoverCallExpressionAndAsyncArrowHead . - If head Contains symbol is
true , returntrue . - Return
AsyncConciseBody Contains symbol.
Contains is used to detect new.target, this, and super usage within an
- If symbol is
MethodDefinition , returntrue . - Return the result of
ComputedPropertyContains ofMethodDefinition with argument symbol.
- Return
false .
- If
MemberExpression Contains symbol istrue , returntrue . - Return
false .
- If symbol is the
ReservedWord super, returntrue . - Return
false .
- If
CallExpression Contains symbol istrue , returntrue . - Return
false .
- Return
false .
- If
OptionalChain Contains symbol istrue , returntrue . - Return
false .
8.5.2 Static Semantics: ComputedPropertyContains
The
- Return
false .
- Return the result of
ComputedPropertyName Contains symbol.
- Return the result of ComputedPropertyContains of
ClassElementName with argument symbol.
- Return the result of ComputedPropertyContains of
ClassElementName with argument symbol.
- Return the result of ComputedPropertyContains of
ClassElementName with argument symbol.
- Let inList be ComputedPropertyContains of
ClassElementList with argument symbol. - If inList is
true , returntrue . - Return the result of ComputedPropertyContains of
ClassElement with argument symbol.
- Return
false .
- Return
false .
- Return the result of ComputedPropertyContains of
ClassElementName with argument symbol.
- Return the result of ComputedPropertyContains of
ClassElementName with argument symbol.
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 the
StringValue ofIdentifier . - Return ?
InitializeBoundName (name, value, environment).
- Return ?
InitializeBoundName ("yield" , value, environment).
- Return ?
InitializeBoundName ("await" , value, environment).
- Perform ?
RequireObjectCoercible (value). - Return ? BindingInitialization of
ObjectBindingPattern 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 of
BindingRestElement with arguments iteratorRecord and environment.
- Perform ? IteratorBindingInitialization of
BindingElementList with arguments iteratorRecord and environment. - Return ?
IteratorDestructuringAssignmentEvaluation ofElision with argument iteratorRecord.
- Perform ? IteratorBindingInitialization of
BindingElementList with arguments iteratorRecord and environment. - If
Elision is present, then- Perform ?
IteratorDestructuringAssignmentEvaluation ofElision with argument iteratorRecord.
- Perform ?
- Return ? IteratorBindingInitialization of
BindingRestElement with arguments iteratorRecord and environment.
- Perform ? IteratorBindingInitialization of
BindingElementList with arguments iteratorRecord and environment. - Return ? IteratorBindingInitialization of
BindingElisionElement with arguments iteratorRecord and environment.
- Perform ?
IteratorDestructuringAssignmentEvaluation ofElision with argument iteratorRecord. - Return ? IteratorBindingInitialization of
BindingElement with arguments iteratorRecord and environment.
- Let bindingId be the
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 of
FormalParameterList with arguments iteratorRecord and environment. - Return ? IteratorBindingInitialization of
FunctionRestParameter with arguments iteratorRecord and environment.
- Perform ? IteratorBindingInitialization of
FormalParameterList with arguments iteratorRecord and environment. - Return ? IteratorBindingInitialization of
FormalParameter 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
IsStrict (thisIdentifierReference ) istrue and theStringValue ofIdentifier is either"eval" or"arguments" , returninvalid . - Return
simple .
- Return
simple .
- Let expr be the
ParenthesizedExpression that iscovered byCoverParenthesizedExpressionAndArrowParameterList . - Return the AssignmentTargetType of expr.
- Return
invalid .
8.6.5 Static Semantics: PropName
The
- Return the
StringValue ofIdentifierReference .
- Return
empty .
- Return the PropName of
PropertyName .
- Return the
StringValue ofIdentifierName .
- Return the
SV ofStringLiteral .
- Let nbr be the
NumericValue ofNumericLiteral . - Return !
ToString (nbr).
- Return
empty .
- Return the PropName of
ClassElementName .
- Return the PropName of
ClassElementName .
- Return the PropName of
ClassElementName .
- Return
empty .
- Return
empty .
- Return the PropName of
ClassElementName .
- Return the PropName of
ClassElementName .
- Return
empty .