Showing content from https://tc39.es/ecma262/multipage/syntax-directed-operations.html below:
ECMAScript® 2026 Language Specification
In addition to those defined in this section, specialized syntax-directed operations are defined throughout this specification.
8.2 Scope Analysis 8.2.1 Static Semantics: BoundNames
The syntax-directed operation BoundNames takes no arguments and returns a List of Strings.
Note
"*default*" is used within this specification as a synthetic name for a module's default export when it does not have another name. An entry in the module's [[Environment]] is created with that name and holds the corresponding value, and resolving the export named "default" by calling ResolveExport ( exportName [ , resolveSet ] ) for the module will return a ResolvedBinding Record whose [[BindingName]] is "*default*" , which will then resolve in the module's [[Environment]] to the above-mentioned value. This is done only for ease of specification, so that anonymous default exports can be resolved like any other export. This "*default*" string is never accessible to ECMAScript code or to the module linking algorithm.
It is defined piecewise over the following productions:
BindingIdentifier : Identifier
- Return a List whose sole element is the StringValue of Identifier .
BindingIdentifier : yield
- Return « "yield" ».
BindingIdentifier : await
- Return « "await" ».
LexicalDeclaration : LetOrConst BindingList ;
- Return the BoundNames of BindingList .
BindingList : BindingList , LexicalBinding
- Let names1 be the BoundNames of BindingList .
- Let names2 be the BoundNames of LexicalBinding .
- Return the list-concatenation of names1 and names2.
LexicalBinding : BindingIdentifier Initializer opt
- Return the BoundNames of BindingIdentifier .
LexicalBinding : BindingPattern Initializer
- Return the BoundNames of BindingPattern .
VariableDeclarationList : VariableDeclarationList , VariableDeclaration
- Let names1 be the BoundNames of VariableDeclarationList .
- Let names2 be the BoundNames of VariableDeclaration .
- Return the list-concatenation of names1 and names2.
VariableDeclaration : BindingIdentifier Initializer opt
- Return the BoundNames of BindingIdentifier .
VariableDeclaration : BindingPattern Initializer
- Return the BoundNames of BindingPattern .
ObjectBindingPattern : { }
- Return a new empty List .
ObjectBindingPattern : { BindingPropertyList , BindingRestProperty }
- Let names1 be the BoundNames of BindingPropertyList .
- Let names2 be the BoundNames of BindingRestProperty .
- Return the list-concatenation of names1 and names2.
ArrayBindingPattern : [ Elision opt ]
- Return a new empty List .
ArrayBindingPattern : [ Elision opt BindingRestElement ]
- Return the BoundNames of BindingRestElement .
ArrayBindingPattern : [ BindingElementList , Elision opt ]
- Return the BoundNames of BindingElementList .
ArrayBindingPattern : [ BindingElementList , Elision opt BindingRestElement ]
- Let names1 be the BoundNames of BindingElementList .
- Let names2 be the BoundNames of BindingRestElement .
- Return the list-concatenation of names1 and names2.
BindingPropertyList : BindingPropertyList , BindingProperty
- Let names1 be the BoundNames of BindingPropertyList .
- Let names2 be the BoundNames of BindingProperty .
- Return the list-concatenation of names1 and names2.
BindingElementList : BindingElementList , BindingElisionElement
- Let names1 be the BoundNames of BindingElementList .
- Let names2 be the BoundNames of BindingElisionElement .
- Return the list-concatenation of names1 and names2.
BindingElisionElement : Elision opt BindingElement
- Return the BoundNames of BindingElement .
BindingProperty : PropertyName : BindingElement
- Return the BoundNames of BindingElement .
SingleNameBinding : BindingIdentifier Initializer opt
- Return the BoundNames of BindingIdentifier .
BindingElement : BindingPattern Initializer opt
- Return the BoundNames of BindingPattern .
ForDeclaration : LetOrConst ForBinding
- Return the BoundNames of ForBinding .
FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
- Return the BoundNames of BindingIdentifier .
FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
- Return « "*default*" ».
FormalParameters : [empty]
- Return a new empty List .
FormalParameters : FormalParameterList , FunctionRestParameter
- Let names1 be the BoundNames of FormalParameterList .
- Let names2 be the BoundNames of FunctionRestParameter .
- Return the list-concatenation of names1 and names2.
FormalParameterList : FormalParameterList , FormalParameter
- Let names1 be the BoundNames of FormalParameterList .
- Let names2 be the BoundNames of FormalParameter .
- Return the list-concatenation of names1 and names2.
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
- Let formals be the ArrowFormalParameters that is covered by CoverParenthesizedExpressionAndArrowParameterList .
- Return the BoundNames of formals.
GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
- Return the BoundNames of BindingIdentifier .
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
- Return « "*default*" ».
AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
- Return the BoundNames of BindingIdentifier .
AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
- Return « "*default*" ».
ClassDeclaration : class BindingIdentifier ClassTail
- Return the BoundNames of BindingIdentifier .
ClassDeclaration : class ClassTail
- Return « "*default*" ».
AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
- Return the BoundNames of BindingIdentifier .
AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
- Return « "*default*" ».
CoverCallExpressionAndAsyncArrowHead : MemberExpression Arguments
- Let head be the AsyncArrowHead that is covered by CoverCallExpressionAndAsyncArrowHead .
- Return the BoundNames of head.
ImportDeclaration : import ImportClause FromClause WithClause opt ;
- Return the BoundNames of ImportClause .
ImportDeclaration : import ModuleSpecifier WithClause opt ;
- Return a new empty List .
ImportClause : ImportedDefaultBinding , NameSpaceImport
- Let names1 be the BoundNames of ImportedDefaultBinding .
- Let names2 be the BoundNames of NameSpaceImport .
- Return the list-concatenation of names1 and names2.
ImportClause : ImportedDefaultBinding , NamedImports
- Let names1 be the BoundNames of ImportedDefaultBinding .
- Let names2 be the BoundNames of NamedImports .
- Return the list-concatenation of names1 and names2.
NamedImports : { }
- Return a new empty List .
ImportsList : ImportsList , ImportSpecifier
- Let names1 be the BoundNames of ImportsList .
- Let names2 be the BoundNames of ImportSpecifier .
- Return the list-concatenation of names1 and names2.
ImportSpecifier : ModuleExportName as ImportedBinding
- Return the BoundNames of ImportedBinding .
ExportDeclaration : export ExportFromClause FromClause WithClause opt ; export NamedExports ;
- Return a new empty List .
ExportDeclaration : export VariableStatement
- Return the BoundNames of VariableStatement .
ExportDeclaration : export Declaration
- Return the BoundNames of Declaration .
ExportDeclaration : export default HoistableDeclaration
- Let declarationNames be the BoundNames of HoistableDeclaration .
- If declarationNames does not include the element "*default*" , append "*default*" to declarationNames.
- Return declarationNames.
ExportDeclaration : export default ClassDeclaration
- Let declarationNames be the BoundNames of ClassDeclaration .
- If declarationNames does not include the element "*default*" , append "*default*" to declarationNames.
- Return declarationNames.
ExportDeclaration : export default AssignmentExpression ;
- Return « "*default*" ».
8.2.2 Static Semantics: DeclarationPart
The syntax-directed operation DeclarationPart takes no arguments and returns a Parse Node . It is defined piecewise over the following productions:
HoistableDeclaration : FunctionDeclaration
- Return FunctionDeclaration .
HoistableDeclaration : GeneratorDeclaration
- Return GeneratorDeclaration .
HoistableDeclaration : AsyncFunctionDeclaration
- Return AsyncFunctionDeclaration .
HoistableDeclaration : AsyncGeneratorDeclaration
- Return AsyncGeneratorDeclaration .
Declaration : ClassDeclaration
- Return ClassDeclaration .
Declaration : LexicalDeclaration
- Return LexicalDeclaration .
8.2.3 Static Semantics: IsConstantDeclaration
The syntax-directed operation IsConstantDeclaration takes no arguments and returns a Boolean. It is defined piecewise over the following productions:
LexicalDeclaration : LetOrConst BindingList ;
- Return IsConstantDeclaration of LetOrConst .
LetOrConst : let
- Return false .
LetOrConst : const
- Return true .
FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } function ( FormalParameters ) { FunctionBody } GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } function * ( FormalParameters ) { GeneratorBody } AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } async function * ( FormalParameters ) { AsyncGeneratorBody } AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } async function ( FormalParameters ) { AsyncFunctionBody }
- Return false .
ClassDeclaration : class BindingIdentifier ClassTail class ClassTail
- Return false .
ExportDeclaration : export ExportFromClause FromClause ; export NamedExports ; export default AssignmentExpression ;
- Return false .
Note
It is not necessary to treat export default
AssignmentExpression as a constant declaration because there is no syntax that permits assignment to the internal bound name used to reference a module's default object.
8.2.4 Static Semantics: LexicallyDeclaredNames
The syntax-directed operation LexicallyDeclaredNames takes no arguments and returns a List of Strings. It is defined piecewise over the following productions:
Block : { }
- Return a new empty List .
StatementList : StatementList StatementListItem
- Let names1 be the LexicallyDeclaredNames of StatementList .
- Let names2 be the LexicallyDeclaredNames of StatementListItem .
- Return the list-concatenation of names1 and names2.
StatementListItem : Statement
- If Statement is Statement : LabelledStatement , return the LexicallyDeclaredNames of LabelledStatement .
- Return a new empty List .
StatementListItem : Declaration
- Return the BoundNames of Declaration .
CaseBlock : { }
- Return a new empty List .
CaseBlock : { CaseClauses opt DefaultClause CaseClauses opt }
- If the first CaseClauses is present, let names1 be the LexicallyDeclaredNames of the first CaseClauses .
- 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 second CaseClauses .
- Else, let names3 be a new empty List .
- Return the list-concatenation of names1, names2, and names3.
CaseClauses : CaseClauses CaseClause
- Let names1 be the LexicallyDeclaredNames of CaseClauses .
- Let names2 be the LexicallyDeclaredNames of CaseClause .
- Return the list-concatenation of names1 and names2.
CaseClause : case Expression : StatementList opt
- If the StatementList is present, return the LexicallyDeclaredNames of StatementList .
- Return a new empty List .
DefaultClause : default : StatementList opt
- If the StatementList is present, return the LexicallyDeclaredNames of StatementList .
- Return a new empty List .
LabelledStatement : LabelIdentifier : LabelledItem
- Return the LexicallyDeclaredNames of LabelledItem .
LabelledItem : Statement
- Return a new empty List .
LabelledItem : FunctionDeclaration
- Return the BoundNames of FunctionDeclaration .
FunctionStatementList : [empty]
- Return a new empty List .
FunctionStatementList : StatementList
- Return the TopLevelLexicallyDeclaredNames of StatementList .
ClassStaticBlockStatementList : [empty]
- Return a new empty List .
ClassStaticBlockStatementList : StatementList
- Return the TopLevelLexicallyDeclaredNames of StatementList .
ConciseBody : ExpressionBody
- Return a new empty List .
AsyncConciseBody : ExpressionBody
- Return a new empty List .
Script : [empty]
- Return a new empty List .
ScriptBody : StatementList
- Return the TopLevelLexicallyDeclaredNames of StatementList .
Note 1
At the top level of a Script , function declarations are treated like var declarations rather than like lexical declarations.
Note 2
The LexicallyDeclaredNames of a Module includes the names of all of its imported bindings.
ModuleItemList : ModuleItemList ModuleItem
- Let names1 be the LexicallyDeclaredNames of ModuleItemList .
- Let names2 be the LexicallyDeclaredNames of ModuleItem .
- Return the list-concatenation of names1 and names2.
ModuleItem : ImportDeclaration
- Return the BoundNames of ImportDeclaration .
ModuleItem : ExportDeclaration
- If ExportDeclaration is
export
VariableStatement , return a new empty List .
- Return the BoundNames of ExportDeclaration .
ModuleItem : StatementListItem
- Return the LexicallyDeclaredNames of StatementListItem .
Note 3
At the top level of a Module , function declarations are treated like lexical declarations rather than like var declarations.
8.2.5 Static Semantics: LexicallyScopedDeclarations
The syntax-directed operation LexicallyScopedDeclarations takes no arguments and returns a List of Parse Nodes . It is defined piecewise over the following productions:
StatementList : StatementList StatementListItem
- Let declarations1 be the LexicallyScopedDeclarations of StatementList .
- Let declarations2 be the LexicallyScopedDeclarations of StatementListItem .
- Return the list-concatenation of declarations1 and declarations2.
StatementListItem : Statement
- If Statement is Statement : LabelledStatement , return the LexicallyScopedDeclarations of LabelledStatement .
- Return a new empty List .
StatementListItem : Declaration
- Return a List whose sole element is the DeclarationPart of Declaration .
CaseBlock : { }
- Return a new empty List .
CaseBlock : { CaseClauses opt DefaultClause CaseClauses opt }
- If the first CaseClauses is present, let declarations1 be the LexicallyScopedDeclarations of the first CaseClauses .
- 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 second CaseClauses .
- Else, let declarations3 be a new empty List .
- Return the list-concatenation of declarations1, declarations2, and declarations3.
CaseClauses : CaseClauses CaseClause
- Let declarations1 be the LexicallyScopedDeclarations of CaseClauses .
- Let declarations2 be the LexicallyScopedDeclarations of CaseClause .
- Return the list-concatenation of declarations1 and declarations2.
CaseClause : case Expression : StatementList opt
- If the StatementList is present, return the LexicallyScopedDeclarations of StatementList .
- Return a new empty List .
DefaultClause : default : StatementList opt
- If the StatementList is present, return the LexicallyScopedDeclarations of StatementList .
- Return a new empty List .
LabelledStatement : LabelIdentifier : LabelledItem
- Return the LexicallyScopedDeclarations of LabelledItem .
LabelledItem : Statement
- Return a new empty List .
LabelledItem : FunctionDeclaration
- Return « FunctionDeclaration ».
FunctionStatementList : [empty]
- Return a new empty List .
FunctionStatementList : StatementList
- Return the TopLevelLexicallyScopedDeclarations of StatementList .
ClassStaticBlockStatementList : [empty]
- Return a new empty List .
ClassStaticBlockStatementList : StatementList
- Return the TopLevelLexicallyScopedDeclarations of StatementList .
ConciseBody : ExpressionBody
- Return a new empty List .
AsyncConciseBody : ExpressionBody
- Return a new empty List .
Script : [empty]
- Return a new empty List .
ScriptBody : StatementList
- Return the TopLevelLexicallyScopedDeclarations of StatementList .
Module : [empty]
- Return a new empty List .
ModuleItemList : ModuleItemList ModuleItem
- Let declarations1 be the LexicallyScopedDeclarations of ModuleItemList .
- Let declarations2 be the LexicallyScopedDeclarations of ModuleItem .
- Return the list-concatenation of declarations1 and declarations2.
ModuleItem : ImportDeclaration
- Return a new empty List .
ExportDeclaration : export ExportFromClause FromClause WithClause opt ; export NamedExports ; export VariableStatement
- Return a new empty List .
ExportDeclaration : export Declaration
- Return a List whose sole element is the DeclarationPart of Declaration .
ExportDeclaration : export default HoistableDeclaration
- Return a List whose sole element is the DeclarationPart of HoistableDeclaration .
ExportDeclaration : export default ClassDeclaration
- Return a List whose sole element is ClassDeclaration .
ExportDeclaration : export default AssignmentExpression ;
- Return a List whose sole element is this ExportDeclaration .
8.2.6 Static Semantics: VarDeclaredNames
The syntax-directed operation VarDeclaredNames takes no arguments and returns a List of Strings. It is defined piecewise over the following productions:
Statement : EmptyStatement ExpressionStatement ContinueStatement BreakStatement ReturnStatement ThrowStatement DebuggerStatement
- Return a new empty List .
Block : { }
- Return a new empty List .
StatementList : StatementList StatementListItem
- Let names1 be the VarDeclaredNames of StatementList .
- Let names2 be the VarDeclaredNames of StatementListItem .
- Return the list-concatenation of names1 and names2.
StatementListItem : Declaration
- Return a new empty List .
VariableStatement : var VariableDeclarationList ;
- Return the BoundNames of VariableDeclarationList .
IfStatement : if ( Expression ) Statement else Statement
- 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.
IfStatement : if ( Expression ) Statement
- Return the VarDeclaredNames of Statement .
DoWhileStatement : do Statement while ( Expression ) ;
- Return the VarDeclaredNames of Statement .
WhileStatement : while ( Expression ) Statement
- Return the VarDeclaredNames of Statement .
ForStatement : for ( Expression opt ; Expression opt ; Expression opt ) Statement
- Return the VarDeclaredNames of Statement .
ForStatement : for ( var VariableDeclarationList ; Expression opt ; Expression opt ) Statement
- Let names1 be the BoundNames of VariableDeclarationList .
- Let names2 be the VarDeclaredNames of Statement .
- Return the list-concatenation of names1 and names2.
ForStatement : for ( LexicalDeclaration Expression opt ; Expression opt ) Statement
- Return the VarDeclaredNames of Statement .
ForInOfStatement : for ( LeftHandSideExpression in Expression ) Statement for ( ForDeclaration in Expression ) Statement for ( LeftHandSideExpression of AssignmentExpression ) Statement for ( ForDeclaration of AssignmentExpression ) Statement for await ( LeftHandSideExpression of AssignmentExpression ) Statement for await ( ForDeclaration of AssignmentExpression ) Statement
- Return the VarDeclaredNames of Statement .
ForInOfStatement : for ( var ForBinding in Expression ) Statement for ( var ForBinding of AssignmentExpression ) Statement for await ( var ForBinding of AssignmentExpression ) Statement
- Let names1 be the BoundNames of ForBinding .
- Let names2 be the VarDeclaredNames of Statement .
- Return the list-concatenation of names1 and names2.
Note
This section is extended by Annex B.3.5 .
WithStatement : with ( Expression ) Statement
- Return the VarDeclaredNames of Statement .
SwitchStatement : switch ( Expression ) CaseBlock
- Return the VarDeclaredNames of CaseBlock .
CaseBlock : { }
- Return a new empty List .
CaseBlock : { CaseClauses opt DefaultClause CaseClauses opt }
- If the first CaseClauses is present, let names1 be the VarDeclaredNames of the first CaseClauses .
- 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 second CaseClauses .
- Else, let names3 be a new empty List .
- Return the list-concatenation of names1, names2, and names3.
CaseClauses : CaseClauses CaseClause
- Let names1 be the VarDeclaredNames of CaseClauses .
- Let names2 be the VarDeclaredNames of CaseClause .
- Return the list-concatenation of names1 and names2.
CaseClause : case Expression : StatementList opt
- If the StatementList is present, return the VarDeclaredNames of StatementList .
- Return a new empty List .
DefaultClause : default : StatementList opt
- If the StatementList is present, return the VarDeclaredNames of StatementList .
- Return a new empty List .
LabelledStatement : LabelIdentifier : LabelledItem
- Return the VarDeclaredNames of LabelledItem .
LabelledItem : FunctionDeclaration
- Return a new empty List .
TryStatement : try Block Catch
- Let names1 be the VarDeclaredNames of Block .
- Let names2 be the VarDeclaredNames of Catch .
- Return the list-concatenation of names1 and names2.
TryStatement : try Block Finally
- Let names1 be the VarDeclaredNames of Block .
- Let names2 be the VarDeclaredNames of Finally .
- Return the list-concatenation of names1 and names2.
TryStatement : try Block Catch Finally
- 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.
Catch : catch ( CatchParameter ) Block
- Return the VarDeclaredNames of Block .
FunctionStatementList : [empty]
- Return a new empty List .
FunctionStatementList : StatementList
- Return the TopLevelVarDeclaredNames of StatementList .
ClassStaticBlockStatementList : [empty]
- Return a new empty List .
ClassStaticBlockStatementList : StatementList
- Return the TopLevelVarDeclaredNames of StatementList .
ConciseBody : ExpressionBody
- Return a new empty List .
AsyncConciseBody : ExpressionBody
- Return a new empty List .
Script : [empty]
- Return a new empty List .
ScriptBody : StatementList
- Return the TopLevelVarDeclaredNames of StatementList .
ModuleItemList : ModuleItemList ModuleItem
- Let names1 be the VarDeclaredNames of ModuleItemList .
- Let names2 be the VarDeclaredNames of ModuleItem .
- Return the list-concatenation of names1 and names2.
ModuleItem : ImportDeclaration
- Return a new empty List .
ModuleItem : ExportDeclaration
- If ExportDeclaration is
export
VariableStatement , return the BoundNames of ExportDeclaration .
- Return a new empty List .
8.2.7 Static Semantics: VarScopedDeclarations
The syntax-directed operation VarScopedDeclarations takes no arguments and returns a List of Parse Nodes . It is defined piecewise over the following productions:
Statement : EmptyStatement ExpressionStatement ContinueStatement BreakStatement ReturnStatement ThrowStatement DebuggerStatement
- Return a new empty List .
Block : { }
- Return a new empty List .
StatementList : StatementList StatementListItem
- Let declarations1 be the VarScopedDeclarations of StatementList .
- Let declarations2 be the VarScopedDeclarations of StatementListItem .
- Return the list-concatenation of declarations1 and declarations2.
StatementListItem : Declaration
- Return a new empty List .
VariableDeclarationList : VariableDeclaration
- Return « VariableDeclaration ».
VariableDeclarationList : VariableDeclarationList , VariableDeclaration
- Let declarations1 be the VarScopedDeclarations of VariableDeclarationList .
- Return the list-concatenation of declarations1 and « VariableDeclaration ».
IfStatement : if ( Expression ) Statement else Statement
- 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.
IfStatement : if ( Expression ) Statement
- Return the VarScopedDeclarations of Statement .
DoWhileStatement : do Statement while ( Expression ) ;
- Return the VarScopedDeclarations of Statement .
WhileStatement : while ( Expression ) Statement
- Return the VarScopedDeclarations of Statement .
ForStatement : for ( Expression opt ; Expression opt ; Expression opt ) Statement
- Return the VarScopedDeclarations of Statement .
ForStatement : for ( var VariableDeclarationList ; Expression opt ; Expression opt ) Statement
- Let declarations1 be the VarScopedDeclarations of VariableDeclarationList .
- Let declarations2 be the VarScopedDeclarations of Statement .
- Return the list-concatenation of declarations1 and declarations2.
ForStatement : for ( LexicalDeclaration Expression opt ; Expression opt ) Statement
- Return the VarScopedDeclarations of Statement .
ForInOfStatement : for ( LeftHandSideExpression in Expression ) Statement for ( ForDeclaration in Expression ) Statement for ( LeftHandSideExpression of AssignmentExpression ) Statement for ( ForDeclaration of AssignmentExpression ) Statement for await ( LeftHandSideExpression of AssignmentExpression ) Statement for await ( ForDeclaration of AssignmentExpression ) Statement
- Return the VarScopedDeclarations of Statement .
ForInOfStatement : for ( var ForBinding in Expression ) Statement for ( var ForBinding of AssignmentExpression ) Statement for await ( var ForBinding of AssignmentExpression ) Statement
- Let declarations1 be « ForBinding ».
- Let declarations2 be the VarScopedDeclarations of Statement .
- Return the list-concatenation of declarations1 and declarations2.
Note
This section is extended by Annex B.3.5 .
WithStatement : with ( Expression ) Statement
- Return the VarScopedDeclarations of Statement .
SwitchStatement : switch ( Expression ) CaseBlock
- Return the VarScopedDeclarations of CaseBlock .
CaseBlock : { }
- Return a new empty List .
CaseBlock : { CaseClauses opt DefaultClause CaseClauses opt }
- If the first CaseClauses is present, let declarations1 be the VarScopedDeclarations of the first CaseClauses .
- 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 second CaseClauses .
- Else, let declarations3 be a new empty List .
- Return the list-concatenation of declarations1, declarations2, and declarations3.
CaseClauses : CaseClauses CaseClause
- Let declarations1 be the VarScopedDeclarations of CaseClauses .
- Let declarations2 be the VarScopedDeclarations of CaseClause .
- Return the list-concatenation of declarations1 and declarations2.
CaseClause : case Expression : StatementList opt
- If the StatementList is present, return the VarScopedDeclarations of StatementList .
- Return a new empty List .
DefaultClause : default : StatementList opt
- If the StatementList is present, return the VarScopedDeclarations of StatementList .
- Return a new empty List .
LabelledStatement : LabelIdentifier : LabelledItem
- Return the VarScopedDeclarations of LabelledItem .
LabelledItem : FunctionDeclaration
- Return a new empty List .
TryStatement : try Block Catch
- Let declarations1 be the VarScopedDeclarations of Block .
- Let declarations2 be the VarScopedDeclarations of Catch .
- Return the list-concatenation of declarations1 and declarations2.
TryStatement : try Block Finally
- Let declarations1 be the VarScopedDeclarations of Block .
- Let declarations2 be the VarScopedDeclarations of Finally .
- Return the list-concatenation of declarations1 and declarations2.
TryStatement : try Block Catch Finally
- 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.
Catch : catch ( CatchParameter ) Block
- Return the VarScopedDeclarations of Block .
FunctionStatementList : [empty]
- Return a new empty List .
FunctionStatementList : StatementList
- Return the TopLevelVarScopedDeclarations of StatementList .
ClassStaticBlockStatementList : [empty]
- Return a new empty List .
ClassStaticBlockStatementList : StatementList
- Return the TopLevelVarScopedDeclarations of StatementList .
ConciseBody : ExpressionBody
- Return a new empty List .
AsyncConciseBody : ExpressionBody
- Return a new empty List .
Script : [empty]
- Return a new empty List .
ScriptBody : StatementList
- Return the TopLevelVarScopedDeclarations of StatementList .
Module : [empty]
- Return a new empty List .
ModuleItemList : ModuleItemList ModuleItem
- Let declarations1 be the VarScopedDeclarations of ModuleItemList .
- Let declarations2 be the VarScopedDeclarations of ModuleItem .
- Return the list-concatenation of declarations1 and declarations2.
ModuleItem : ImportDeclaration
- Return a new empty List .
ModuleItem : ExportDeclaration
- If ExportDeclaration is
export
VariableStatement , return the VarScopedDeclarations of VariableStatement .
- Return a new empty List .
8.2.8 Static Semantics: TopLevelLexicallyDeclaredNames
The syntax-directed operation TopLevelLexicallyDeclaredNames takes no arguments and returns a List of Strings. It is defined piecewise over the following productions:
StatementList : StatementList StatementListItem
- Let names1 be the TopLevelLexicallyDeclaredNames of StatementList .
- Let names2 be the TopLevelLexicallyDeclaredNames of StatementListItem .
- Return the list-concatenation of names1 and names2.
StatementListItem : Statement
- Return a new empty List .
StatementListItem : Declaration
- If Declaration is Declaration : HoistableDeclaration , then
- Return a new empty List .
- Return the BoundNames of Declaration .
Note
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 syntax-directed operation TopLevelLexicallyScopedDeclarations takes no arguments and returns a List of Parse Nodes . It is defined piecewise over the following productions:
StatementList : StatementList StatementListItem
- Let declarations1 be the TopLevelLexicallyScopedDeclarations of StatementList .
- Let declarations2 be the TopLevelLexicallyScopedDeclarations of StatementListItem .
- Return the list-concatenation of declarations1 and declarations2.
StatementListItem : Statement
- Return a new empty List .
StatementListItem : Declaration
- If Declaration is Declaration : HoistableDeclaration , then
- Return a new empty List .
- Return « Declaration ».
8.2.10 Static Semantics: TopLevelVarDeclaredNames
The syntax-directed operation TopLevelVarDeclaredNames takes no arguments and returns a List of Strings. It is defined piecewise over the following productions:
StatementList : StatementList StatementListItem
- Let names1 be the TopLevelVarDeclaredNames of StatementList .
- Let names2 be the TopLevelVarDeclaredNames of StatementListItem .
- Return the list-concatenation of names1 and names2.
StatementListItem : Declaration
- If Declaration is Declaration : HoistableDeclaration , then
- Return the BoundNames of HoistableDeclaration .
- Return a new empty List .
StatementListItem : Statement
- If Statement is Statement : LabelledStatement , return the TopLevelVarDeclaredNames of Statement .
- Return the VarDeclaredNames of Statement .
Note
At the top level of a function or script, inner function declarations are treated like var declarations.
LabelledStatement : LabelIdentifier : LabelledItem
- Return the TopLevelVarDeclaredNames of LabelledItem .
LabelledItem : Statement
- If Statement is Statement : LabelledStatement , return the TopLevelVarDeclaredNames of Statement .
- Return the VarDeclaredNames of Statement .
LabelledItem : FunctionDeclaration
- Return the BoundNames of FunctionDeclaration .
8.2.11 Static Semantics: TopLevelVarScopedDeclarations
The syntax-directed operation TopLevelVarScopedDeclarations takes no arguments and returns a List of Parse Nodes . It is defined piecewise over the following productions:
StatementList : StatementList StatementListItem
- Let declarations1 be the TopLevelVarScopedDeclarations of StatementList .
- Let declarations2 be the TopLevelVarScopedDeclarations of StatementListItem .
- Return the list-concatenation of declarations1 and declarations2.
StatementListItem : Statement
- If Statement is Statement : LabelledStatement , return the TopLevelVarScopedDeclarations of Statement .
- Return the VarScopedDeclarations of Statement .
StatementListItem : Declaration
- If Declaration is Declaration : HoistableDeclaration , then
- Let declaration be the DeclarationPart of HoistableDeclaration .
- Return « declaration ».
- Return a new empty List .
LabelledStatement : LabelIdentifier : LabelledItem
- Return the TopLevelVarScopedDeclarations of LabelledItem .
LabelledItem : Statement
- If Statement is Statement : LabelledStatement , return the TopLevelVarScopedDeclarations of Statement .
- Return the VarScopedDeclarations of Statement .
LabelledItem : FunctionDeclaration
- Return « FunctionDeclaration ».
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4