8 语法指引操作 (Syntax-Directed Operations)

除了本节定义的操作外,规范其余部分还定义了许多专门的语法指引操作。

8.1 运行时语义:Evaluation

The syntax-directed operation 运行时语义:Evaluation takes no arguments and returns 一个 Completion Record.

Note
本操作的定义分布在本规范“ECMAScript Language”各章节中。每个定义出现在相关产生式首次定义之后。

8.2 作用域分析 (Scope Analysis)

8.2.1 静态语义:BoundNames

The syntax-directed operation 静态语义:BoundNames takes no arguments and returns 一个字符串列表.

Note

"*default*" 在本规范中用作模块默认导出的合成名称(当它没有其它名称时)。模块的 [[Environment]] 中会以该名称创建一个条目并保存相应的值,对该模块调用 ResolveExport ( exportName [ , resolveSet ] ) 解析名为 "default" 的导出会返回一个 [[BindingName]]"*default*"ResolvedBinding Record,随后它在模块的 [[Environment]] 中解析为上述的值。此举仅为规范书写方便,使匿名默认导出能与其它导出统一解析。该 "*default*" 字符串在 ECMAScript 代码及模块链接算法中不可见。

It is defined piecewise over the following productions:

BindingIdentifier : Identifier
  1. 返回仅含 Identifier 的 StringValue 的列表。
BindingIdentifier : yield
  1. 返回 « "yield" »。
BindingIdentifier : await
  1. 返回 « "await" »。
LexicalDeclaration : LetOrConst BindingList ;
  1. 返回 BindingList 的 BoundNames。
BindingList : BindingList , LexicalBinding
  1. names1BindingList 的 BoundNames。
  2. names2LexicalBinding 的 BoundNames。
  3. 返回 names1names2列表拼接
LexicalBinding : BindingIdentifier Initializeropt
  1. 返回 BindingIdentifier 的 BoundNames。
LexicalBinding : BindingPattern Initializer
  1. 返回 BindingPattern 的 BoundNames。
VariableDeclarationList : VariableDeclarationList , VariableDeclaration
  1. names1VariableDeclarationList 的 BoundNames。
  2. names2VariableDeclaration 的 BoundNames。
  3. 返回 names1names2列表拼接
VariableDeclaration : BindingIdentifier Initializeropt
  1. 返回 BindingIdentifier 的 BoundNames。
VariableDeclaration : BindingPattern Initializer
  1. 返回 BindingPattern 的 BoundNames。
ObjectBindingPattern : { }
  1. 返回一个新的空列表。
ObjectBindingPattern : { BindingPropertyList , BindingRestProperty }
  1. names1BindingPropertyList 的 BoundNames。
  2. names2BindingRestProperty 的 BoundNames。
  3. 返回 names1names2列表拼接
ArrayBindingPattern : [ Elisionopt ]
  1. 返回一个新的空列表。
ArrayBindingPattern : [ Elisionopt BindingRestElement ]
  1. 返回 BindingRestElement 的 BoundNames。
ArrayBindingPattern : [ BindingElementList , Elisionopt ]
  1. 返回 BindingElementList 的 BoundNames。
ArrayBindingPattern : [ BindingElementList , Elisionopt BindingRestElement ]
  1. names1BindingElementList 的 BoundNames。
  2. names2BindingRestElement 的 BoundNames。
  3. 返回 names1names2列表拼接
BindingPropertyList : BindingPropertyList , BindingProperty
  1. names1BindingPropertyList 的 BoundNames。
  2. names2BindingProperty 的 BoundNames。
  3. 返回 names1names2列表拼接
BindingElementList : BindingElementList , BindingElisionElement
  1. names1BindingElementList 的 BoundNames。
  2. names2BindingElisionElement 的 BoundNames。
  3. 返回 names1names2列表拼接
BindingElisionElement : Elisionopt BindingElement
  1. 返回 BindingElement 的 BoundNames。
BindingProperty : PropertyName : BindingElement
  1. 返回 BindingElement 的 BoundNames。
SingleNameBinding : BindingIdentifier Initializeropt
  1. 返回 BindingIdentifier 的 BoundNames。
BindingElement : BindingPattern Initializeropt
  1. 返回 BindingPattern 的 BoundNames。
ForDeclaration : LetOrConst ForBinding
  1. 返回 ForBinding 的 BoundNames。
FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
  1. 返回 BindingIdentifier 的 BoundNames。
FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
  1. 返回 « "*default*" »。
FormalParameters : [empty]
  1. 返回一个新的空列表。
FormalParameters : FormalParameterList , FunctionRestParameter
  1. names1FormalParameterList 的 BoundNames。
  2. names2FunctionRestParameter 的 BoundNames。
  3. 返回 names1names2列表拼接
FormalParameterList : FormalParameterList , FormalParameter
  1. names1FormalParameterList 的 BoundNames。
  2. names2FormalParameter 的 BoundNames。
  3. 返回 names1names2列表拼接
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
  1. formalsCoverParenthesizedExpressionAndArrowParameterList 覆盖ArrowFormalParameters
  2. 返回 formals 的 BoundNames。
GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
  1. 返回 BindingIdentifier 的 BoundNames。
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
  1. 返回 « "*default*" »。
AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
  1. 返回 BindingIdentifier 的 BoundNames。
AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
  1. 返回 « "*default*" »。
ClassDeclaration : class BindingIdentifier ClassTail
  1. 返回 BindingIdentifier 的 BoundNames。
ClassDeclaration : class ClassTail
  1. 返回 « "*default*" »。
AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
  1. 返回 BindingIdentifier 的 BoundNames。
AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
  1. 返回 « "*default*" »。
CoverCallExpressionAndAsyncArrowHead : MemberExpression Arguments
  1. headCoverCallExpressionAndAsyncArrowHead 覆盖AsyncArrowHead
  2. 返回 head 的 BoundNames。
ImportDeclaration : import ImportClause FromClause WithClauseopt ;
  1. 返回 ImportClause 的 BoundNames。
ImportDeclaration : import ModuleSpecifier WithClauseopt ;
  1. 返回一个新的空列表。
ImportClause : ImportedDefaultBinding , NameSpaceImport
  1. names1ImportedDefaultBinding 的 BoundNames。
  2. names2NameSpaceImport 的 BoundNames。
  3. 返回 names1names2列表拼接
ImportClause : ImportedDefaultBinding , NamedImports
  1. names1ImportedDefaultBinding 的 BoundNames。
  2. names2NamedImports 的 BoundNames。
  3. 返回 names1names2列表拼接
NamedImports : { }
  1. 返回一个新的空列表。
ImportsList : ImportsList , ImportSpecifier
  1. names1ImportsList 的 BoundNames。
  2. names2ImportSpecifier 的 BoundNames。
  3. 返回 names1names2列表拼接
ImportSpecifier : ModuleExportName as ImportedBinding
  1. 返回 ImportedBinding 的 BoundNames。
ExportDeclaration : export ExportFromClause FromClause WithClauseopt ; export NamedExports ;
  1. 返回一个新的空列表。
ExportDeclaration : export VariableStatement
  1. 返回 VariableStatement 的 BoundNames。
ExportDeclaration : export Declaration
  1. 返回 Declaration 的 BoundNames。
ExportDeclaration : export default HoistableDeclaration
  1. declarationNamesHoistableDeclaration 的 BoundNames。
  2. declarationNames 不含 "*default*",将 "*default*" 添加到 declarationNames
  3. 返回 declarationNames
ExportDeclaration : export default ClassDeclaration
  1. declarationNamesClassDeclaration 的 BoundNames。
  2. declarationNames 不含 "*default*",将 "*default*" 添加到 declarationNames
  3. 返回 declarationNames
ExportDeclaration : export default AssignmentExpression ;
  1. 返回 « "*default*" »。

8.2.2 静态语义:DeclarationPart

The syntax-directed operation 静态语义:DeclarationPart takes no arguments and returns 一个 Parse Node. It is defined piecewise over the following productions:

HoistableDeclaration : FunctionDeclaration
  1. 返回 FunctionDeclaration
HoistableDeclaration : GeneratorDeclaration
  1. 返回 GeneratorDeclaration
HoistableDeclaration : AsyncFunctionDeclaration
  1. 返回 AsyncFunctionDeclaration
HoistableDeclaration : AsyncGeneratorDeclaration
  1. 返回 AsyncGeneratorDeclaration
Declaration : ClassDeclaration
  1. 返回 ClassDeclaration
Declaration : LexicalDeclaration
  1. 返回 LexicalDeclaration

8.2.3 静态语义:IsConstantDeclaration

The syntax-directed operation 静态语义:IsConstantDeclaration takes no arguments and returns 一个 Boolean. It is defined piecewise over the following productions:

LexicalDeclaration : LetOrConst BindingList ;
  1. 返回 LetOrConst 的 IsConstantDeclaration。
LetOrConst : let
  1. 返回 false
LetOrConst : const
  1. 返回 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 }
  1. 返回 false
ClassDeclaration : class BindingIdentifier ClassTail class ClassTail
  1. 返回 false
ExportDeclaration : export ExportFromClause FromClause ; export NamedExports ; export default AssignmentExpression ;
  1. 返回 false
Note

无需将 export default AssignmentExpression 视作常量声明,因为不存在语法允许对用于引用模块默认对象的内部绑定名赋值。

8.2.4 静态语义:LexicallyDeclaredNames

The syntax-directed operation 静态语义:LexicallyDeclaredNames takes no arguments and returns 一个字符串列表. It is defined piecewise over the following productions:

Block : { }
  1. 返回一个新的空列表。
StatementList : StatementList StatementListItem
  1. names1StatementList 的 LexicallyDeclaredNames。
  2. names2StatementListItem 的 LexicallyDeclaredNames。
  3. 返回 names1names2列表拼接
StatementListItem : Statement
  1. Statement Statement : LabelledStatement ,返回 LabelledStatement 的 LexicallyDeclaredNames。
  2. 返回一个新的空列表。
StatementListItem : Declaration
  1. 返回 Declaration 的 BoundNames。
CaseBlock : { }
  1. 返回一个新的空列表。
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 若第一个 CaseClauses 存在,令 names1 为其 LexicallyDeclaredNames;否则 names1 为新空列表。
  2. names2DefaultClause 的 LexicallyDeclaredNames。
  3. 若第二个 CaseClauses 存在,令 names3 为其 LexicallyDeclaredNames;否则 names3 为新空列表。
  4. 返回 names1names2names3列表拼接
CaseClauses : CaseClauses CaseClause
  1. names1CaseClauses 的 LexicallyDeclaredNames。
  2. names2CaseClause 的 LexicallyDeclaredNames。
  3. 返回 names1names2列表拼接
CaseClause : case Expression : StatementListopt
  1. StatementList 存在,返回其 LexicallyDeclaredNames。
  2. 返回一个新的空列表。
DefaultClause : default : StatementListopt
  1. StatementList 存在,返回其 LexicallyDeclaredNames。
  2. 返回一个新的空列表。
LabelledStatement : LabelIdentifier : LabelledItem
  1. 返回 LabelledItem 的 LexicallyDeclaredNames。
LabelledItem : Statement
  1. 返回一个新的空列表。
LabelledItem : FunctionDeclaration
  1. 返回 FunctionDeclaration 的 BoundNames。
FunctionStatementList : [empty]
  1. 返回一个新的空列表。
FunctionStatementList : StatementList
  1. 返回 StatementList 的 TopLevelLexicallyDeclaredNames。
ClassStaticBlockStatementList : [empty]
  1. 返回一个新的空列表。
ClassStaticBlockStatementList : StatementList
  1. 返回 StatementList 的 TopLevelLexicallyDeclaredNames。
ConciseBody : ExpressionBody
  1. 返回一个新的空列表。
AsyncConciseBody : ExpressionBody
  1. 返回一个新的空列表。
Script : [empty]
  1. 返回一个新的空列表。
ScriptBody : StatementList
  1. 返回 StatementList 的 TopLevelLexicallyDeclaredNames。
Note 1

Script 顶层的函数声明按 var 声明处理,而非按词法声明处理。

Note 2

Module 的 LexicallyDeclaredNames 包含其所有导入绑定的名称。

ModuleItemList : ModuleItemList ModuleItem
  1. names1ModuleItemList 的 LexicallyDeclaredNames。
  2. names2ModuleItem 的 LexicallyDeclaredNames。
  3. 返回 names1names2列表拼接
ModuleItem : ImportDeclaration
  1. 返回 ImportDeclaration 的 BoundNames。
ModuleItem : ExportDeclaration
  1. ExportDeclarationexport VariableStatement,返回一个新的空列表。
  2. 返回 ExportDeclaration 的 BoundNames。
ModuleItem : StatementListItem
  1. 返回 StatementListItem 的 LexicallyDeclaredNames。
Note 3

Module 顶层的函数声明按词法声明处理,而非按 var 声明。

8.2.5 静态语义:LexicallyScopedDeclarations

The syntax-directed operation 静态语义:LexicallyScopedDeclarations takes no arguments and returns 一个 Parse Node 列表. It is defined piecewise over the following productions:

StatementList : StatementList StatementListItem
  1. declarations1StatementList 的 LexicallyScopedDeclarations。
  2. declarations2StatementListItem 的 LexicallyScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
StatementListItem : Statement
  1. Statement Statement : LabelledStatement ,返回 LabelledStatement 的 LexicallyScopedDeclarations。
  2. 返回一个新的空列表。
StatementListItem : Declaration
  1. 返回仅含 Declaration 的 DeclarationPart 的列表。
CaseBlock : { }
  1. 返回一个新的空列表。
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 若第一个 CaseClauses 存在,令 declarations1 为其 LexicallyScopedDeclarations;否则 declarations1 为新空列表。
  2. declarations2DefaultClause 的 LexicallyScopedDeclarations。
  3. 若第二个 CaseClauses 存在,令 declarations3 为其 LexicallyScopedDeclarations;否则 declarations3 为新空列表。
  4. 返回 declarations1declarations2declarations3列表拼接
CaseClauses : CaseClauses CaseClause
  1. declarations1CaseClauses 的 LexicallyScopedDeclarations。
  2. declarations2CaseClause 的 LexicallyScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
CaseClause : case Expression : StatementListopt
  1. StatementList 存在,返回其 LexicallyScopedDeclarations。
  2. 返回一个新的空列表。
DefaultClause : default : StatementListopt
  1. StatementList 存在,返回其 LexicallyScopedDeclarations。
  2. 返回一个新的空列表。
LabelledStatement : LabelIdentifier : LabelledItem
  1. 返回 LabelledItem 的 LexicallyScopedDeclarations。
LabelledItem : Statement
  1. 返回一个新的空列表。
LabelledItem : FunctionDeclaration
  1. 返回 « FunctionDeclaration »。
FunctionStatementList : [empty]
  1. 返回一个新的空列表。
FunctionStatementList : StatementList
  1. 返回 StatementList 的 TopLevelLexicallyScopedDeclarations。
ClassStaticBlockStatementList : [empty]
  1. 返回一个新的空列表。
ClassStaticBlockStatementList : StatementList
  1. 返回 StatementList 的 TopLevelLexicallyScopedDeclarations。
ConciseBody : ExpressionBody
  1. 返回一个新的空列表。
AsyncConciseBody : ExpressionBody
  1. 返回一个新的空列表。
Script : [empty]
  1. 返回一个新的空列表。
ScriptBody : StatementList
  1. 返回 StatementList 的 TopLevelLexicallyScopedDeclarations。
Module : [empty]
  1. 返回一个新的空列表。
ModuleItemList : ModuleItemList ModuleItem
  1. declarations1ModuleItemList 的 LexicallyScopedDeclarations。
  2. declarations2ModuleItem 的 LexicallyScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
ModuleItem : ImportDeclaration
  1. 返回一个新的空列表。
ExportDeclaration : export ExportFromClause FromClause WithClauseopt ; export NamedExports ; export VariableStatement
  1. 返回一个新的空列表。
ExportDeclaration : export Declaration
  1. 返回仅含 Declaration 的 DeclarationPart 的列表。
ExportDeclaration : export default HoistableDeclaration
  1. 返回仅含 HoistableDeclaration 的 DeclarationPart 的列表。
ExportDeclaration : export default ClassDeclaration
  1. 返回仅含 ClassDeclaration 的列表。
ExportDeclaration : export default AssignmentExpression ;
  1. 返回仅含本 ExportDeclaration 的列表。

8.2.6 静态语义:VarDeclaredNames

The syntax-directed operation 静态语义:VarDeclaredNames takes no arguments and returns 一个字符串列表. It is defined piecewise over the following productions:

Statement : EmptyStatement ExpressionStatement ContinueStatement BreakStatement ReturnStatement ThrowStatement DebuggerStatement
  1. 返回一个新的空列表。
Block : { }
  1. 返回一个新的空列表。
StatementList : StatementList StatementListItem
  1. names1StatementList 的 VarDeclaredNames。
  2. names2StatementListItem 的 VarDeclaredNames。
  3. 返回 names1names2列表拼接
StatementListItem : Declaration
  1. 返回一个新的空列表。
VariableStatement : var VariableDeclarationList ;
  1. 返回 VariableDeclarationList 的 BoundNames。
IfStatement : if ( Expression ) Statement else Statement
  1. names1 为第一个 Statement 的 VarDeclaredNames。
  2. names2 为第二个 Statement 的 VarDeclaredNames。
  3. 返回 names1names2列表拼接
IfStatement : if ( Expression ) Statement
  1. 返回 Statement 的 VarDeclaredNames。
DoWhileStatement : do Statement while ( Expression ) ;
  1. 返回 Statement 的 VarDeclaredNames。
WhileStatement : while ( Expression ) Statement
  1. 返回 Statement 的 VarDeclaredNames。
ForStatement : for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement
  1. 返回 Statement 的 VarDeclaredNames。
ForStatement : for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
  1. names1VariableDeclarationList 的 BoundNames。
  2. names2Statement 的 VarDeclaredNames。
  3. 返回 names1names2列表拼接
ForStatement : for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
  1. 返回 Statement 的 VarDeclaredNames。
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
  1. 返回 Statement 的 VarDeclaredNames。
ForInOfStatement : for ( var ForBinding in Expression ) Statement for ( var ForBinding of AssignmentExpression ) Statement for await ( var ForBinding of AssignmentExpression ) Statement
  1. names1ForBinding 的 BoundNames。
  2. names2Statement 的 VarDeclaredNames。
  3. 返回 names1names2列表拼接
Note

本节由附件 B.3.5 扩展。

WithStatement : with ( Expression ) Statement
  1. 返回 Statement 的 VarDeclaredNames。
SwitchStatement : switch ( Expression ) CaseBlock
  1. 返回 CaseBlock 的 VarDeclaredNames。
CaseBlock : { }
  1. 返回一个新的空列表。
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 若第一个 CaseClauses 存在,令 names1 为其 VarDeclaredNames;否则 names1 为新空列表。
  2. names2DefaultClause 的 VarDeclaredNames。
  3. 若第二个 CaseClauses 存在,令 names3 为其 VarDeclaredNames;否则 names3 为新空列表。
  4. 返回 names1names2names3列表拼接
CaseClauses : CaseClauses CaseClause
  1. names1CaseClauses 的 VarDeclaredNames。
  2. names2CaseClause 的 VarDeclaredNames。
  3. 返回 names1names2列表拼接
CaseClause : case Expression : StatementListopt
  1. StatementList 存在,返回其 VarDeclaredNames。
  2. 返回一个新的空列表。
DefaultClause : default : StatementListopt
  1. StatementList 存在,返回其 VarDeclaredNames。
  2. 返回一个新的空列表。
LabelledStatement : LabelIdentifier : LabelledItem
  1. 返回 LabelledItem 的 VarDeclaredNames。
LabelledItem : FunctionDeclaration
  1. 返回一个新的空列表。
TryStatement : try Block Catch
  1. names1Block 的 VarDeclaredNames。
  2. names2Catch 的 VarDeclaredNames。
  3. 返回 names1names2列表拼接
TryStatement : try Block Finally
  1. names1Block 的 VarDeclaredNames。
  2. names2Finally 的 VarDeclaredNames。
  3. 返回 names1names2列表拼接
TryStatement : try Block Catch Finally
  1. names1Block 的 VarDeclaredNames。
  2. names2Catch 的 VarDeclaredNames。
  3. names3Finally 的 VarDeclaredNames。
  4. 返回 names1names2names3列表拼接
Catch : catch ( CatchParameter ) Block
  1. 返回 Block 的 VarDeclaredNames。
FunctionStatementList : [empty]
  1. 返回一个新的空列表。
FunctionStatementList : StatementList
  1. 返回 StatementList 的 TopLevelVarDeclaredNames。
ClassStaticBlockStatementList : [empty]
  1. 返回一个新的空列表。
ClassStaticBlockStatementList : StatementList
  1. 返回 StatementList 的 TopLevelVarDeclaredNames。
ConciseBody : ExpressionBody
  1. 返回一个新的空列表。
AsyncConciseBody : ExpressionBody
  1. 返回一个新的空列表。
Script : [empty]
  1. 返回一个新的空列表。
ScriptBody : StatementList
  1. 返回 StatementList 的 TopLevelVarDeclaredNames。
ModuleItemList : ModuleItemList ModuleItem
  1. names1ModuleItemList 的 VarDeclaredNames。
  2. names2ModuleItem 的 VarDeclaredNames。
  3. 返回 names1names2列表拼接
ModuleItem : ImportDeclaration
  1. 返回一个新的空列表。
ModuleItem : ExportDeclaration
  1. ExportDeclarationexport VariableStatement,返回 ExportDeclaration 的 BoundNames。
  2. 返回一个新的空列表。

8.2.7 静态语义:VarScopedDeclarations

The syntax-directed operation 静态语义:VarScopedDeclarations takes no arguments and returns 一个 Parse Node 列表. It is defined piecewise over the following productions:

Statement : EmptyStatement ExpressionStatement ContinueStatement BreakStatement ReturnStatement ThrowStatement DebuggerStatement
  1. 返回一个新的空列表。
Block : { }
  1. 返回一个新的空列表。
StatementList : StatementList StatementListItem
  1. declarations1StatementList 的 VarScopedDeclarations。
  2. declarations2StatementListItem 的 VarScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
StatementListItem : Declaration
  1. 返回一个新的空列表。
VariableDeclarationList : VariableDeclaration
  1. 返回 « VariableDeclaration »。
VariableDeclarationList : VariableDeclarationList , VariableDeclaration
  1. declarations1VariableDeclarationList 的 VarScopedDeclarations。
  2. 返回 declarations1 与 « VariableDeclaration » 的列表拼接
IfStatement : if ( Expression ) Statement else Statement
  1. declarations1 为第一个 Statement 的 VarScopedDeclarations。
  2. declarations2 为第二个 Statement 的 VarScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
IfStatement : if ( Expression ) Statement
  1. 返回 Statement 的 VarScopedDeclarations。
DoWhileStatement : do Statement while ( Expression ) ;
  1. 返回 Statement 的 VarScopedDeclarations。
WhileStatement : while ( Expression ) Statement
  1. 返回 Statement 的 VarScopedDeclarations。
ForStatement : for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement
  1. 返回 Statement 的 VarScopedDeclarations。
ForStatement : for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
  1. declarations1VariableDeclarationList 的 VarScopedDeclarations。
  2. declarations2Statement 的 VarScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
ForStatement : for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
  1. 返回 Statement 的 VarScopedDeclarations。
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
  1. 返回 Statement 的 VarScopedDeclarations。
ForInOfStatement : for ( var ForBinding in Expression ) Statement for ( var ForBinding of AssignmentExpression ) Statement for await ( var ForBinding of AssignmentExpression ) Statement
  1. declarations1 为 « ForBinding »。
  2. declarations2Statement 的 VarScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
Note

本节由附件 B.3.5 扩展。

WithStatement : with ( Expression ) Statement
  1. 返回 Statement 的 VarScopedDeclarations。
SwitchStatement : switch ( Expression ) CaseBlock
  1. 返回 CaseBlock 的 VarScopedDeclarations。
CaseBlock : { }
  1. 返回一个新的空列表。
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 若第一个 CaseClauses 存在,令 declarations1 为其 VarScopedDeclarations;否则 declarations1 为新空列表。
  2. declarations2DefaultClause 的 VarScopedDeclarations。
  3. 若第二个 CaseClauses 存在,令 declarations3 为其 VarScopedDeclarations;否则 declarations3 为新空列表。
  4. 返回 declarations1declarations2declarations3列表拼接
CaseClauses : CaseClauses CaseClause
  1. declarations1CaseClauses 的 VarScopedDeclarations。
  2. declarations2CaseClause 的 VarScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
CaseClause : case Expression : StatementListopt
  1. StatementList 存在,返回其 VarScopedDeclarations。
  2. 返回一个新的空列表。
DefaultClause : default : StatementListopt
  1. StatementList 存在,返回其 VarScopedDeclarations。
  2. 返回一个新的空列表。
LabelledStatement : LabelIdentifier : LabelledItem
  1. 返回 LabelledItem 的 VarScopedDeclarations。
LabelledItem : FunctionDeclaration
  1. 返回一个新的空列表。
TryStatement : try Block Catch
  1. declarations1Block 的 VarScopedDeclarations。
  2. declarations2Catch 的 VarScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
TryStatement : try Block Finally
  1. declarations1Block 的 VarScopedDeclarations。
  2. declarations2Finally 的 VarScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
TryStatement : try Block Catch Finally
  1. declarations1Block 的 VarScopedDeclarations。
  2. declarations2Catch 的 VarScopedDeclarations。
  3. declarations3Finally 的 VarScopedDeclarations。
  4. 返回 declarations1declarations2declarations3列表拼接
Catch : catch ( CatchParameter ) Block
  1. 返回 Block 的 VarScopedDeclarations。
FunctionStatementList : [empty]
  1. 返回一个新的空列表。
FunctionStatementList : StatementList
  1. 返回 StatementList 的 TopLevelVarScopedDeclarations。
ClassStaticBlockStatementList : [empty]
  1. 返回一个新的空列表。
ClassStaticBlockStatementList : StatementList
  1. 返回 StatementList 的 TopLevelVarScopedDeclarations。
ConciseBody : ExpressionBody
  1. 返回一个新的空列表。
AsyncConciseBody : ExpressionBody
  1. 返回一个新的空列表。
Script : [empty]
  1. 返回一个新的空列表。
ScriptBody : StatementList
  1. 返回 StatementList 的 TopLevelVarScopedDeclarations。
Module : [empty]
  1. 返回一个新的空列表。
ModuleItemList : ModuleItemList ModuleItem
  1. declarations1ModuleItemList 的 VarScopedDeclarations。
  2. declarations2ModuleItem 的 VarScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
ModuleItem : ImportDeclaration
  1. 返回一个新的空列表。
ModuleItem : ExportDeclaration
  1. ExportDeclarationexport VariableStatement,返回 VariableStatement 的 VarScopedDeclarations。
  2. 返回一个新的空列表。

8.2.8 静态语义:TopLevelLexicallyDeclaredNames

The syntax-directed operation 静态语义:TopLevelLexicallyDeclaredNames takes no arguments and returns 一个字符串列表. It is defined piecewise over the following productions:

StatementList : StatementList StatementListItem
  1. names1StatementList 的 TopLevelLexicallyDeclaredNames。
  2. names2StatementListItem 的 TopLevelLexicallyDeclaredNames。
  3. 返回 names1names2列表拼接
StatementListItem : Statement
  1. 返回一个新的空列表。
StatementListItem : Declaration
  1. Declaration Declaration : HoistableDeclaration
    1. 返回一个新的空列表。
  2. 返回 Declaration 的 BoundNames。
Note

函数或脚本顶层中,函数声明按 var 声明而非词法声明处理。

8.2.9 静态语义:TopLevelLexicallyScopedDeclarations

The syntax-directed operation 静态语义:TopLevelLexicallyScopedDeclarations takes no arguments and returns 一个 Parse Node 列表. It is defined piecewise over the following productions:

StatementList : StatementList StatementListItem
  1. declarations1StatementList 的 TopLevelLexicallyScopedDeclarations。
  2. declarations2StatementListItem 的 TopLevelLexicallyScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
StatementListItem : Statement
  1. 返回一个新的空列表。
StatementListItem : Declaration
  1. Declaration Declaration : HoistableDeclaration
    1. 返回一个新的空列表。
  2. 返回 « Declaration »。

8.2.10 静态语义:TopLevelVarDeclaredNames

The syntax-directed operation 静态语义:TopLevelVarDeclaredNames takes no arguments and returns 一个字符串列表. It is defined piecewise over the following productions:

StatementList : StatementList StatementListItem
  1. names1StatementList 的 TopLevelVarDeclaredNames。
  2. names2StatementListItem 的 TopLevelVarDeclaredNames。
  3. 返回 names1names2列表拼接
StatementListItem : Declaration
  1. Declaration Declaration : HoistableDeclaration
    1. 返回 HoistableDeclaration 的 BoundNames。
  2. 返回一个新的空列表。
StatementListItem : Statement
  1. Statement Statement : LabelledStatement ,返回 Statement 的 TopLevelVarDeclaredNames。
  2. 返回 Statement 的 VarDeclaredNames。
Note

函数或脚本顶层的内部函数声明按 var 声明处理。

LabelledStatement : LabelIdentifier : LabelledItem
  1. 返回 LabelledItem 的 TopLevelVarDeclaredNames。
LabelledItem : Statement
  1. Statement Statement : LabelledStatement ,返回 Statement 的 TopLevelVarDeclaredNames。
  2. 返回 Statement 的 VarDeclaredNames。
LabelledItem : FunctionDeclaration
  1. 返回 FunctionDeclaration 的 BoundNames。

8.2.11 静态语义:TopLevelVarScopedDeclarations

The syntax-directed operation 静态语义:TopLevelVarScopedDeclarations takes no arguments and returns 一个 Parse Node 列表. It is defined piecewise over the following productions:

StatementList : StatementList StatementListItem
  1. declarations1StatementList 的 TopLevelVarScopedDeclarations。
  2. declarations2StatementListItem 的 TopLevelVarScopedDeclarations。
  3. 返回 declarations1declarations2列表拼接
StatementListItem : Statement
  1. Statement Statement : LabelledStatement ,返回 Statement 的 TopLevelVarScopedDeclarations。
  2. 返回 Statement 的 VarScopedDeclarations。
StatementListItem : Declaration
  1. Declaration Declaration : HoistableDeclaration
    1. declarationHoistableDeclaration 的 DeclarationPart。
    2. 返回 « declaration »。
  2. 返回一个新的空列表。
LabelledStatement : LabelIdentifier : LabelledItem
  1. 返回 LabelledItem 的 TopLevelVarScopedDeclarations。
LabelledItem : Statement
  1. Statement Statement : LabelledStatement ,返回 Statement 的 TopLevelVarScopedDeclarations。
  2. 返回 Statement 的 VarScopedDeclarations。
LabelledItem : FunctionDeclaration
  1. 返回 « FunctionDeclaration »。

8.3 标签 (Labels)

8.3.1 静态语义:ContainsDuplicateLabels

The syntax-directed operation 静态语义:ContainsDuplicateLabels takes argument labelSet (一个字符串列表) and returns 一个 Boolean. It is defined piecewise over the following productions:

Statement : VariableStatement EmptyStatement ExpressionStatement ContinueStatement BreakStatement ReturnStatement ThrowStatement DebuggerStatement Block : { } StatementListItem : Declaration
  1. 返回 false
StatementList : StatementList StatementListItem
  1. hasDuplicatesStatementList 的 ContainsDuplicateLabels(参数 labelSet)。
  2. hasDuplicatestrue,返回 true
  3. 返回 StatementListItem 的 ContainsDuplicateLabels(参数 labelSet)。
IfStatement : if ( Expression ) Statement else Statement
  1. hasDuplicate 为第一个 Statement 的 ContainsDuplicateLabels(参数 labelSet)。
  2. hasDuplicatetrue,返回 true
  3. 返回第二个 Statement 的 ContainsDuplicateLabels(参数 labelSet)。
IfStatement : if ( Expression ) Statement
  1. 返回 Statement 的 ContainsDuplicateLabels(参数 labelSet)。
DoWhileStatement : do Statement while ( Expression ) ;
  1. 返回 Statement 的 ContainsDuplicateLabels(参数 labelSet)。
WhileStatement : while ( Expression ) Statement
  1. 返回 Statement 的 ContainsDuplicateLabels(参数 labelSet)。
ForStatement : for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
  1. 返回 Statement 的 ContainsDuplicateLabels(参数 labelSet)。
ForInOfStatement : for ( LeftHandSideExpression in Expression ) Statement for ( var ForBinding in Expression ) Statement for ( ForDeclaration in Expression ) Statement for ( LeftHandSideExpression of AssignmentExpression ) Statement for ( var ForBinding of AssignmentExpression ) Statement for ( ForDeclaration of AssignmentExpression ) Statement for await ( LeftHandSideExpression of AssignmentExpression ) Statement for await ( var ForBinding of AssignmentExpression ) Statement for await ( ForDeclaration of AssignmentExpression ) Statement
  1. 返回 Statement 的 ContainsDuplicateLabels(参数 labelSet)。
Note

本节由附录 B.3.5 扩展。

WithStatement : with ( Expression ) Statement
  1. 返回 Statement 的 ContainsDuplicateLabels(参数 labelSet)。
SwitchStatement : switch ( Expression ) CaseBlock
  1. 返回 CaseBlock 的 ContainsDuplicateLabels(参数 labelSet)。
CaseBlock : { }
  1. 返回 false
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 若第一个 CaseClauses 存在,则
    1. 若第一个 CaseClauses 的 ContainsDuplicateLabels(参数 labelSet)为 true,返回 true
  2. DefaultClause 的 ContainsDuplicateLabels(参数 labelSet)为 true,返回 true
  3. 若第二个 CaseClauses 不存在,返回 false
  4. 返回第二个 CaseClauses 的 ContainsDuplicateLabels(参数 labelSet)。
CaseClauses : CaseClauses CaseClause
  1. hasDuplicatesCaseClauses 的 ContainsDuplicateLabels(参数 labelSet)。
  2. hasDuplicatestrue,返回 true
  3. 返回 CaseClause 的 ContainsDuplicateLabels(参数 labelSet)。
CaseClause : case Expression : StatementListopt
  1. StatementList 存在,返回其 ContainsDuplicateLabels(参数 labelSet)。
  2. 返回 false
DefaultClause : default : StatementListopt
  1. StatementList 存在,返回其 ContainsDuplicateLabels(参数 labelSet)。
  2. 返回 false
LabelledStatement : LabelIdentifier : LabelledItem
  1. labelLabelIdentifier 的 StringValue。
  2. labelSet 包含 label,返回 true
  3. newLabelSetlabelSet 与 « label » 的列表拼接
  4. 返回 LabelledItem 的 ContainsDuplicateLabels(参数 newLabelSet)。
LabelledItem : FunctionDeclaration
  1. 返回 false
TryStatement : try Block Catch
  1. hasDuplicatesBlock 的 ContainsDuplicateLabels(参数 labelSet)。
  2. hasDuplicatestrue,返回 true
  3. 返回 Catch 的 ContainsDuplicateLabels(参数 labelSet)。
TryStatement : try Block Finally
  1. hasDuplicatesBlock 的 ContainsDuplicateLabels(参数 labelSet)。
  2. hasDuplicatestrue,返回 true
  3. 返回 Finally 的 ContainsDuplicateLabels(参数 labelSet)。
TryStatement : try Block Catch Finally
  1. Block 的 ContainsDuplicateLabels(参数 labelSet)为 true,返回 true
  2. Catch 的 ContainsDuplicateLabels(参数 labelSet)为 true,返回 true
  3. 返回 Finally 的 ContainsDuplicateLabels(参数 labelSet)。
Catch : catch ( CatchParameter ) Block
  1. 返回 Block 的 ContainsDuplicateLabels(参数 labelSet)。
FunctionStatementList : [empty]
  1. 返回 false
ClassStaticBlockStatementList : [empty]
  1. 返回 false
ModuleItemList : ModuleItemList ModuleItem
  1. hasDuplicatesModuleItemList 的 ContainsDuplicateLabels(参数 labelSet)。
  2. hasDuplicatestrue,返回 true
  3. 返回 ModuleItem 的 ContainsDuplicateLabels(参数 labelSet)。
ModuleItem : ImportDeclaration ExportDeclaration
  1. 返回 false

8.3.2 静态语义:ContainsUndefinedBreakTarget

The syntax-directed operation 静态语义:ContainsUndefinedBreakTarget takes argument labelSet (一个字符串列表) and returns 一个 Boolean. It is defined piecewise over the following productions:

Statement : VariableStatement EmptyStatement ExpressionStatement ContinueStatement ReturnStatement ThrowStatement DebuggerStatement Block : { } StatementListItem : Declaration
  1. 返回 false
StatementList : StatementList StatementListItem
  1. hasUndefinedLabelsStatementList 的 ContainsUndefinedBreakTarget(参数 labelSet)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回 StatementListItem 的 ContainsUndefinedBreakTarget(参数 labelSet)。
IfStatement : if ( Expression ) Statement else Statement
  1. hasUndefinedLabels 为第一个 Statement 的 ContainsUndefinedBreakTarget(参数 labelSet)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回第二个 Statement 的 ContainsUndefinedBreakTarget(参数 labelSet)。
IfStatement : if ( Expression ) Statement
  1. 返回 Statement 的 ContainsUndefinedBreakTarget(参数 labelSet)。
DoWhileStatement : do Statement while ( Expression ) ;
  1. 返回 Statement 的 ContainsUndefinedBreakTarget(参数 labelSet)。
WhileStatement : while ( Expression ) Statement
  1. 返回 Statement 的 ContainsUndefinedBreakTarget(参数 labelSet)。
ForStatement : for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
  1. 返回 Statement 的 ContainsUndefinedBreakTarget(参数 labelSet)。
ForInOfStatement : for ( LeftHandSideExpression in Expression ) Statement for ( var ForBinding in Expression ) Statement for ( ForDeclaration in Expression ) Statement for ( LeftHandSideExpression of AssignmentExpression ) Statement for ( var ForBinding of AssignmentExpression ) Statement for ( ForDeclaration of AssignmentExpression ) Statement for await ( LeftHandSideExpression of AssignmentExpression ) Statement for await ( var ForBinding of AssignmentExpression ) Statement for await ( ForDeclaration of AssignmentExpression ) Statement
  1. 返回 Statement 的 ContainsUndefinedBreakTarget(参数 labelSet)。
Note

本节由附录 B.3.5 扩展。

BreakStatement : break ;
  1. 返回 false
BreakStatement : break LabelIdentifier ;
  1. labelSet 不包含 LabelIdentifier 的 StringValue,返回 true
  2. 返回 false
WithStatement : with ( Expression ) Statement
  1. 返回 Statement 的 ContainsUndefinedBreakTarget(参数 labelSet)。
SwitchStatement : switch ( Expression ) CaseBlock
  1. 返回 CaseBlock 的 ContainsUndefinedBreakTarget(参数 labelSet)。
CaseBlock : { }
  1. 返回 false
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 若第一个 CaseClauses 存在,则
    1. 若第一个 CaseClauses 的 ContainsUndefinedBreakTarget(参数 labelSet)为 true,返回 true
  2. DefaultClause 的 ContainsUndefinedBreakTarget(参数 labelSet)为 true,返回 true
  3. 若第二个 CaseClauses 不存在,返回 false
  4. 返回第二个 CaseClauses 的 ContainsUndefinedBreakTarget(参数 labelSet)。
CaseClauses : CaseClauses CaseClause
  1. hasUndefinedLabelsCaseClauses 的 ContainsUndefinedBreakTarget(参数 labelSet)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回 CaseClause 的 ContainsUndefinedBreakTarget(参数 labelSet)。
CaseClause : case Expression : StatementListopt
  1. StatementList 存在,返回其 ContainsUndefinedBreakTarget(参数 labelSet)。
  2. 返回 false
DefaultClause : default : StatementListopt
  1. StatementList 存在,返回其 ContainsUndefinedBreakTarget(参数 labelSet)。
  2. 返回 false
LabelledStatement : LabelIdentifier : LabelledItem
  1. labelLabelIdentifier 的 StringValue。
  2. newLabelSetlabelSet 与 « label » 的列表拼接
  3. 返回 LabelledItem 的 ContainsUndefinedBreakTarget(参数 newLabelSet)。
LabelledItem : FunctionDeclaration
  1. 返回 false
TryStatement : try Block Catch
  1. hasUndefinedLabelsBlock 的 ContainsUndefinedBreakTarget(参数 labelSet)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回 Catch 的 ContainsUndefinedBreakTarget(参数 labelSet)。
TryStatement : try Block Finally
  1. hasUndefinedLabelsBlock 的 ContainsUndefinedBreakTarget(参数 labelSet)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回 Finally 的 ContainsUndefinedBreakTarget(参数 labelSet)。
TryStatement : try Block Catch Finally
  1. Block 的 ContainsUndefinedBreakTarget(参数 labelSet)为 true,返回 true
  2. Catch 的 ContainsUndefinedBreakTarget(参数 labelSet)为 true,返回 true
  3. 返回 Finally 的 ContainsUndefinedBreakTarget(参数 labelSet)。
Catch : catch ( CatchParameter ) Block
  1. 返回 Block 的 ContainsUndefinedBreakTarget(参数 labelSet)。
FunctionStatementList : [empty]
  1. 返回 false
ClassStaticBlockStatementList : [empty]
  1. 返回 false
ModuleItemList : ModuleItemList ModuleItem
  1. hasUndefinedLabelsModuleItemList 的 ContainsUndefinedBreakTarget(参数 labelSet)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回 ModuleItem 的 ContainsUndefinedBreakTarget(参数 labelSet)。
ModuleItem : ImportDeclaration ExportDeclaration
  1. 返回 false

8.3.3 静态语义:ContainsUndefinedContinueTarget

The syntax-directed operation 静态语义:ContainsUndefinedContinueTarget takes arguments iterationSet (一个字符串列表) and labelSet (一个字符串列表) and returns 一个 Boolean. It is defined piecewise over the following productions:

Statement : VariableStatement EmptyStatement ExpressionStatement BreakStatement ReturnStatement ThrowStatement DebuggerStatement Block : { } StatementListItem : Declaration
  1. 返回 false
Statement : BlockStatement
  1. 返回 BlockStatement 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
BreakableStatement : IterationStatement
  1. newIterationSetiterationSetlabelSet列表拼接
  2. 返回 IterationStatement 的 ContainsUndefinedContinueTarget(参数 newIterationSet 与 « »)。
StatementList : StatementList StatementListItem
  1. hasUndefinedLabelsStatementList 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回 StatementListItem 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
IfStatement : if ( Expression ) Statement else Statement
  1. hasUndefinedLabels 为第一个 Statement 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回第二个 Statement 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
IfStatement : if ( Expression ) Statement
  1. 返回 Statement 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
DoWhileStatement : do Statement while ( Expression ) ;
  1. 返回 Statement 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
WhileStatement : while ( Expression ) Statement
  1. 返回 Statement 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
ForStatement : for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
  1. 返回 Statement 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
ForInOfStatement : for ( LeftHandSideExpression in Expression ) Statement for ( var ForBinding in Expression ) Statement for ( ForDeclaration in Expression ) Statement for ( LeftHandSideExpression of AssignmentExpression ) Statement for ( var ForBinding of AssignmentExpression ) Statement for ( ForDeclaration of AssignmentExpression ) Statement for await ( LeftHandSideExpression of AssignmentExpression ) Statement for await ( var ForBinding of AssignmentExpression ) Statement for await ( ForDeclaration of AssignmentExpression ) Statement
  1. 返回 Statement 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
Note

本节由附录 B.3.5 扩展。

ContinueStatement : continue ;
  1. 返回 false
ContinueStatement : continue LabelIdentifier ;
  1. iterationSet 不包含 LabelIdentifier 的 StringValue,返回 true
  2. 返回 false
WithStatement : with ( Expression ) Statement
  1. 返回 Statement 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
SwitchStatement : switch ( Expression ) CaseBlock
  1. 返回 CaseBlock 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
CaseBlock : { }
  1. 返回 false
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 若第一个 CaseClauses 存在,则
    1. 若第一个 CaseClauses 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)为 true,返回 true
  2. DefaultClause 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)为 true,返回 true
  3. 若第二个 CaseClauses 不存在,返回 false
  4. 返回第二个 CaseClauses 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
CaseClauses : CaseClauses CaseClause
  1. hasUndefinedLabelsCaseClauses 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回 CaseClause 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
CaseClause : case Expression : StatementListopt
  1. StatementList 存在,返回其 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
  2. 返回 false
DefaultClause : default : StatementListopt
  1. StatementList 存在,返回其 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
  2. 返回 false
LabelledStatement : LabelIdentifier : LabelledItem
  1. labelLabelIdentifier 的 StringValue。
  2. newLabelSetlabelSet 与 « label » 的列表拼接
  3. 返回 LabelledItem 的 ContainsUndefinedContinueTarget(参数 iterationSetnewLabelSet)。
LabelledItem : FunctionDeclaration
  1. 返回 false
TryStatement : try Block Catch
  1. hasUndefinedLabelsBlock 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回 Catch 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
TryStatement : try Block Finally
  1. hasUndefinedLabelsBlock 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回 Finally 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
TryStatement : try Block Catch Finally
  1. Block 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)为 true,返回 true
  2. Catch 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)为 true,返回 true
  3. 返回 Finally 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
Catch : catch ( CatchParameter ) Block
  1. 返回 Block 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
FunctionStatementList : [empty]
  1. 返回 false
ClassStaticBlockStatementList : [empty]
  1. 返回 false
ModuleItemList : ModuleItemList ModuleItem
  1. hasUndefinedLabelsModuleItemList 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
  2. hasUndefinedLabelstrue,返回 true
  3. 返回 ModuleItem 的 ContainsUndefinedContinueTarget(参数 iterationSet 与 « »)。
ModuleItem : ImportDeclaration ExportDeclaration
  1. 返回 false

8.4 函数名称推断 (Function Name Inference)

8.4.1 静态语义:HasName

The syntax-directed operation 静态语义:HasName takes no arguments and returns 一个 Boolean. It is defined piecewise over the following productions:

PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList
  1. exprCoverParenthesizedExpressionAndArrowParameterList覆盖ParenthesizedExpression
  2. 如果 expr 的 IsFunctionDefinition 为 false,返回 false
  3. 返回 expr 的 HasName。
FunctionExpression : function ( FormalParameters ) { FunctionBody } GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } AsyncGeneratorExpression : async function * ( FormalParameters ) { AsyncGeneratorBody } AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } ArrowFunction : ArrowParameters => ConciseBody AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody ClassExpression : class ClassTail
  1. 返回 false
FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } ClassExpression : class BindingIdentifier ClassTail
  1. 返回 true

8.4.2 静态语义:IsFunctionDefinition

The syntax-directed operation 静态语义:IsFunctionDefinition takes no arguments and returns 一个 Boolean. It is defined piecewise over the following productions:

PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList
  1. exprCoverParenthesizedExpressionAndArrowParameterList覆盖ParenthesizedExpression
  2. 返回 expr 的 IsFunctionDefinition。
PrimaryExpression : this IdentifierReference Literal ArrayLiteral ObjectLiteral RegularExpressionLiteral TemplateLiteral MemberExpression : MemberExpression [ Expression ] MemberExpression . IdentifierName MemberExpression TemplateLiteral SuperProperty MetaProperty new MemberExpression Arguments MemberExpression . PrivateIdentifier NewExpression : new NewExpression LeftHandSideExpression : CallExpression OptionalExpression UpdateExpression : LeftHandSideExpression ++ LeftHandSideExpression -- ++ UnaryExpression -- UnaryExpression UnaryExpression : delete UnaryExpression void UnaryExpression typeof UnaryExpression + UnaryExpression - UnaryExpression ~ UnaryExpression ! UnaryExpression AwaitExpression ExponentiationExpression : UpdateExpression ** ExponentiationExpression MultiplicativeExpression : MultiplicativeExpression MultiplicativeOperator ExponentiationExpression AdditiveExpression : AdditiveExpression + MultiplicativeExpression AdditiveExpression - MultiplicativeExpression ShiftExpression : ShiftExpression << AdditiveExpression ShiftExpression >> AdditiveExpression ShiftExpression >>> AdditiveExpression RelationalExpression : RelationalExpression < ShiftExpression RelationalExpression > ShiftExpression RelationalExpression <= ShiftExpression RelationalExpression >= ShiftExpression RelationalExpression instanceof ShiftExpression RelationalExpression in ShiftExpression PrivateIdentifier in ShiftExpression EqualityExpression : EqualityExpression == RelationalExpression EqualityExpression != RelationalExpression EqualityExpression === RelationalExpression EqualityExpression !== RelationalExpression BitwiseANDExpression : BitwiseANDExpression & EqualityExpression BitwiseXORExpression : BitwiseXORExpression ^ BitwiseANDExpression BitwiseORExpression : BitwiseORExpression | BitwiseXORExpression LogicalANDExpression : LogicalANDExpression && BitwiseORExpression LogicalORExpression : LogicalORExpression || LogicalANDExpression CoalesceExpression : CoalesceExpressionHead ?? BitwiseORExpression ConditionalExpression : ShortCircuitExpression ? AssignmentExpression : AssignmentExpression AssignmentExpression : YieldExpression LeftHandSideExpression = AssignmentExpression LeftHandSideExpression AssignmentOperator AssignmentExpression LeftHandSideExpression &&= AssignmentExpression LeftHandSideExpression ||= AssignmentExpression LeftHandSideExpression ??= AssignmentExpression Expression : Expression , AssignmentExpression
  1. 返回 false
AssignmentExpression : ArrowFunction AsyncArrowFunction FunctionExpression : function BindingIdentifieropt ( FormalParameters ) { FunctionBody } GeneratorExpression : function * BindingIdentifieropt ( FormalParameters ) { GeneratorBody } AsyncGeneratorExpression : async function * BindingIdentifieropt ( FormalParameters ) { AsyncGeneratorBody } AsyncFunctionExpression : async function BindingIdentifieropt ( FormalParameters ) { AsyncFunctionBody } ClassExpression : class BindingIdentifieropt ClassTail
  1. 返回 true

8.4.3 静态语义:IsAnonymousFunctionDefinition ( expr )

The abstract operation 静态语义:IsAnonymousFunctionDefinition takes argument expr (一个 AssignmentExpression Parse Node、一个 Initializer Parse Node、或一个 Expression Parse Node) and returns 一个 Boolean. 用于判定其参数是否为未绑定名称的函数定义。 It performs the following steps when called:

  1. 如果 expr 的 IsFunctionDefinition 为 false,返回 false
  2. hasNameexpr 的 HasName。
  3. 如果 hasNametrue,返回 false
  4. 返回 true

8.4.4 静态语义:IsIdentifierRef

The syntax-directed operation 静态语义:IsIdentifierRef takes no arguments and returns 一个 Boolean. It is defined piecewise over the following productions:

PrimaryExpression : IdentifierReference
  1. 返回 true
PrimaryExpression : this Literal ArrayLiteral ObjectLiteral FunctionExpression ClassExpression GeneratorExpression AsyncFunctionExpression AsyncGeneratorExpression RegularExpressionLiteral TemplateLiteral CoverParenthesizedExpressionAndArrowParameterList MemberExpression : MemberExpression [ Expression ] MemberExpression . IdentifierName MemberExpression TemplateLiteral SuperProperty MetaProperty new MemberExpression Arguments MemberExpression . PrivateIdentifier NewExpression : new NewExpression LeftHandSideExpression : CallExpression OptionalExpression
  1. 返回 false

8.4.5 运行时语义:NamedEvaluation

The syntax-directed operation 运行时语义:NamedEvaluation takes argument name (一个属性键或一个 Private Name) and returns 返回包含一个函数对象正常完成或一个异常完成. It is defined piecewise over the following productions:

PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList
  1. exprCoverParenthesizedExpressionAndArrowParameterList覆盖ParenthesizedExpression
  2. 返回 ? expr 的 NamedEvaluation(参数 name)。
ParenthesizedExpression : ( Expression )
  1. 断言:IsAnonymousFunctionDefinition(Expression) 为 true
  2. 返回 ? Expression 的 NamedEvaluation(参数 name)。
FunctionExpression : function ( FormalParameters ) { FunctionBody }
  1. 返回 FunctionExpression 的 InstantiateOrdinaryFunctionExpression(参数 name)。
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
  1. 返回 GeneratorExpression 的 InstantiateGeneratorFunctionExpression(参数 name)。
AsyncGeneratorExpression : async function * ( FormalParameters ) { AsyncGeneratorBody }
  1. 返回 AsyncGeneratorExpression 的 InstantiateAsyncGeneratorFunctionExpression(参数 name)。
AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
  1. 返回 AsyncFunctionExpression 的 InstantiateAsyncFunctionExpression(参数 name)。
ArrowFunction : ArrowParameters => ConciseBody
  1. 返回 ArrowFunction 的 InstantiateArrowFunctionExpression(参数 name)。
AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
  1. 返回 AsyncArrowFunction 的 InstantiateAsyncArrowFunctionExpression(参数 name)。
ClassExpression : class ClassTail
  1. sourceTextClassExpression 匹配的源文本。
  2. 返回 ? ClassTail 的 ClassDefinitionEvaluation(参数 undefined, name, sourceText)。

8.5 Contains

8.5.1 静态语义:Contains

The syntax-directed operation 静态语义:Contains takes argument symbol (一个语法符号) and returns 一个 Boolean.

本规范中未列于下表的每个语法产生式替代都隐式具有如下默认的 Contains 定义:

  1. 对该解析节点的每个子节点 child,执行
    1. childsymbol 的一个实例,返回 true
    2. child 是一个非终结符实例,则
      1. containedchild Contains symbol 的结果。
      2. containedtrue,返回 true
  2. 返回 false
FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } function ( FormalParameters ) { FunctionBody } FunctionExpression : function BindingIdentifieropt ( FormalParameters ) { FunctionBody } GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } function * ( FormalParameters ) { GeneratorBody } GeneratorExpression : function * BindingIdentifieropt ( FormalParameters ) { GeneratorBody } AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } async function * ( FormalParameters ) { AsyncGeneratorBody } AsyncGeneratorExpression : async function * BindingIdentifieropt ( FormalParameters ) { AsyncGeneratorBody } AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } async function ( FormalParameters ) { AsyncFunctionBody } AsyncFunctionExpression : async function BindingIdentifieropt ( FormalParameters ) { AsyncFunctionBody }
  1. 返回 false
Note 1

依赖子结构的静态语义规则通常不会深入函数定义内部。

ClassTail : ClassHeritageopt { ClassBody }
  1. 如果 symbolClassBody,返回 true
  2. 如果 symbolClassHeritage,则
    1. ClassHeritage 存在,返回 true;否则返回 false
  3. ClassHeritage 存在,则
    1. ClassHeritage Contains symboltrue,返回 true
  4. 返回 ClassBody 的 ComputedPropertyContains(参数 symbol)结果。
Note 2

依赖子结构的静态语义规则通常不会深入类主体,除了 PropertyName

ClassStaticBlock : static { ClassStaticBlockBody }
  1. 返回 false
Note 3

依赖子结构的静态语义规则通常不会深入 static 初始化块。

ArrowFunction : ArrowParameters => ConciseBody
  1. symbol 不在 NewTargetSuperPropertySuperCallsuperthis 之列,返回 false
  2. ArrowParameters Contains symboltrue,返回 true
  3. 返回 ConciseBody Contains symbol
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
  1. formalsCoverParenthesizedExpressionAndArrowParameterList覆盖ArrowFormalParameters
  2. 返回 formals Contains symbol
AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody
  1. symbol 不在 NewTargetSuperPropertySuperCallsuperthis 之列,返回 false
  2. 返回 AsyncConciseBody Contains symbol
AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
  1. symbol 不在 NewTargetSuperPropertySuperCallsuperthis 之列,返回 false
  2. headCoverCallExpressionAndAsyncArrowHead覆盖AsyncArrowHead
  3. head Contains symboltrue,返回 true
  4. 返回 AsyncConciseBody Contains symbol
Note 4

Contains 用于在 ArrowFunctionAsyncArrowFunction 中检测 new.targetthissuper 的使用。

PropertyDefinition : MethodDefinition
  1. 如果 symbolMethodDefinition,返回 true
  2. 返回 MethodDefinition 的 ComputedPropertyContains(参数 symbol)结果。
LiteralPropertyName : IdentifierName
  1. 返回 false
MemberExpression : MemberExpression . IdentifierName
  1. MemberExpression Contains symboltrue,返回 true
  2. 返回 false
SuperProperty : super . IdentifierName
  1. symbol 是保留字 super,返回 true
  2. 返回 false
CallExpression : CallExpression . IdentifierName
  1. CallExpression Contains symboltrue,返回 true
  2. 返回 false
OptionalChain : ?. IdentifierName
  1. 返回 false
OptionalChain : OptionalChain . IdentifierName
  1. OptionalChain Contains symboltrue,返回 true
  2. 返回 false

8.5.2 静态语义:ComputedPropertyContains

The syntax-directed operation 静态语义:ComputedPropertyContains takes argument symbol (一个语法符号) and returns 一个 Boolean. It is defined piecewise over the following productions:

ClassElementName : PrivateIdentifier PropertyName : LiteralPropertyName
  1. 返回 false
PropertyName : ComputedPropertyName
  1. 返回 ComputedPropertyName Contains symbol 的结果。
MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody } get ClassElementName ( ) { FunctionBody } set ClassElementName ( PropertySetParameterList ) { FunctionBody }
  1. 返回 ClassElementName 的 ComputedPropertyContains(参数 symbol)结果。
GeneratorMethod : * ClassElementName ( UniqueFormalParameters ) { GeneratorBody }
  1. 返回 ClassElementName 的 ComputedPropertyContains(参数 symbol)结果。
AsyncGeneratorMethod : async * ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody }
  1. 返回 ClassElementName 的 ComputedPropertyContains(参数 symbol)结果。
ClassElementList : ClassElementList ClassElement
  1. inListClassElementList 的 ComputedPropertyContains(参数 symbol)。
  2. inListtrue,返回 true
  3. 返回 ClassElement 的 ComputedPropertyContains(参数 symbol)结果。
ClassElement : ClassStaticBlock
  1. 返回 false
ClassElement : ;
  1. 返回 false
AsyncMethod : async ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody }
  1. 返回 ClassElementName 的 ComputedPropertyContains(参数 symbol)结果。
FieldDefinition : ClassElementName Initializeropt
  1. 返回 ClassElementName 的 ComputedPropertyContains(参数 symbol)结果。

8.6 其它 (Miscellaneous)

这些操作在规范的多个位置被使用。

8.6.1 运行时语义:InstantiateFunctionObject

The syntax-directed operation 运行时语义:InstantiateFunctionObject takes arguments env (一个 Environment Record) and privateEnv (一个 PrivateEnvironment Recordnull) and returns 一个 ECMAScript 函数对象. It is defined piecewise over the following productions:

FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } function ( FormalParameters ) { FunctionBody }
  1. 返回 FunctionDeclaration 的 InstantiateOrdinaryFunctionObject(参数 envprivateEnv)。
GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } function * ( FormalParameters ) { GeneratorBody }
  1. 返回 GeneratorDeclaration 的 InstantiateGeneratorFunctionObject(参数 envprivateEnv)。
AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } async function * ( FormalParameters ) { AsyncGeneratorBody }
  1. 返回 AsyncGeneratorDeclaration 的 InstantiateAsyncGeneratorFunctionObject(参数 envprivateEnv)。
AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } async function ( FormalParameters ) { AsyncFunctionBody }
  1. 返回 AsyncFunctionDeclaration 的 InstantiateAsyncFunctionObject(参数 envprivateEnv)。

8.6.2 运行时语义:BindingInitialization

The syntax-directed operation 运行时语义:BindingInitialization takes arguments value (一个 ECMAScript 语言值) and environment (一个 Environment Recordundefined) and returns 返回包含 unused正常完成或一个异常完成.

Note

environment 传入 undefined 时表示应使用 PutValue 操作来赋值初始化值。对于 var 语句以及某些非严格函数的形式参数列表即是这种情况(参见 10.2.11)。在这些情况下词法绑定在其初始化器求值前被提升并预初始化。

It is defined piecewise over the following productions:

BindingIdentifier : Identifier
  1. nameIdentifier 的 StringValue。
  2. 返回 ? InitializeBoundName(name, value, environment)。
BindingIdentifier : yield
  1. 返回 ? InitializeBoundName("yield", value, environment)。
BindingIdentifier : await
  1. 返回 ? InitializeBoundName("await", value, environment)。
BindingPattern : ObjectBindingPattern
  1. 执行 ? RequireObjectCoercible(value)。
  2. 返回 ? ObjectBindingPattern 的 BindingInitialization(参数 value, environment)。
BindingPattern : ArrayBindingPattern
  1. iteratorRecord 为 ? GetIterator(value, sync)。
  2. resultCompletion(ArrayBindingPattern 的 IteratorBindingInitialization(参数 iteratorRecord, environment))。
  3. 如果 iteratorRecord.[[Done]]false,返回 ? IteratorClose(iteratorRecord, result)。
  4. 返回 ? result
ObjectBindingPattern : { }
  1. 返回 unused
ObjectBindingPattern : { BindingPropertyList } { BindingPropertyList , }
  1. 执行 ? BindingPropertyList 的 PropertyBindingInitialization(参数 value, environment)。
  2. 返回 unused
ObjectBindingPattern : { BindingRestProperty }
  1. excludedNames 为新的空列表。
  2. 返回 ? BindingRestProperty 的 RestBindingInitialization(参数 value, environment, excludedNames)。
ObjectBindingPattern : { BindingPropertyList , BindingRestProperty }
  1. excludedNames 为 ? BindingPropertyList 的 PropertyBindingInitialization(参数 value, environment)。
  2. 返回 ? BindingRestProperty 的 RestBindingInitialization(参数 value, environment, excludedNames)。

8.6.2.1 InitializeBoundName ( name, value, environment )

The abstract operation InitializeBoundName takes arguments name (一个 String), value (一个 ECMAScript 语言值), and environment (一个 Environment Recordundefined) and returns 返回包含 unused正常完成或一个异常完成. It performs the following steps when called:

  1. 如果 environment 不为 undefined,则
    1. 执行 ! environment.InitializeBinding(name, value)。
    2. 返回 unused
  2. 否则,
    1. lhs 为 ? ResolveBinding(name)。
    2. 返回 ? PutValue(lhs, value)。

8.6.3 运行时语义:IteratorBindingInitialization

The syntax-directed operation 运行时语义:IteratorBindingInitialization takes arguments iteratorRecord (一个 Iterator Record) and environment (一个 Environment Recordundefined) and returns 返回包含 unused正常完成或一个异常完成.

Note

environmentundefined 时表示应使用 PutValue 操作来赋初始化值。这用于非严格函数的形式参数列表,在那种情况下形式参数绑定会被预初始化以应对同名参数出现的可能。

It is defined piecewise over the following productions:

ArrayBindingPattern : [ ]
  1. 返回 unused
ArrayBindingPattern : [ Elision ]
  1. 返回 ? Elision 的 IteratorDestructuringAssignmentEvaluation(参数 iteratorRecord)。
ArrayBindingPattern : [ Elisionopt BindingRestElement ]
  1. 如果 Elision 存在,则
    1. 执行 ? Elision 的 IteratorDestructuringAssignmentEvaluation(参数 iteratorRecord)。
  2. 返回 ? BindingRestElement 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
ArrayBindingPattern : [ BindingElementList , Elision ]
  1. 执行 ? BindingElementList 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
  2. 返回 ? Elision 的 IteratorDestructuringAssignmentEvaluation(参数 iteratorRecord)。
ArrayBindingPattern : [ BindingElementList , Elisionopt BindingRestElement ]
  1. 执行 ? BindingElementList 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
  2. 如果 Elision 存在,则
    1. 执行 ? Elision 的 IteratorDestructuringAssignmentEvaluation(参数 iteratorRecord)。
  3. 返回 ? BindingRestElement 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
BindingElementList : BindingElementList , BindingElisionElement
  1. 执行 ? BindingElementList 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
  2. 返回 ? BindingElisionElement 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
BindingElisionElement : Elision BindingElement
  1. 执行 ? Elision 的 IteratorDestructuringAssignmentEvaluation(参数 iteratorRecord)。
  2. 返回 ? BindingElement 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
SingleNameBinding : BindingIdentifier Initializeropt
  1. bindingIdBindingIdentifier 的 StringValue。
  2. lhs 为 ? ResolveBinding(bindingId, environment)。
  3. vundefined
  4. 如果 iteratorRecord.[[Done]]false,则
    1. next 为 ? IteratorStepValue(iteratorRecord)。
    2. 如果 next 不是 done,则
      1. vnext
  5. 如果 Initializer 存在且 vundefined,则
    1. 如果 IsAnonymousFunctionDefinition(Initializer) 为 true,则
      1. v 为 ? Initializer 的 NamedEvaluation(参数 bindingId)。
    2. 否则,
      1. defaultValue 为 ? Initializer 的 Evaluation。
      2. v 为 ? GetValue(defaultValue)。
  6. 如果 environmentundefined,返回 ? PutValue(lhs, v)。
  7. 返回 ? InitializeReferencedBinding(lhs, v)。
BindingElement : BindingPattern Initializeropt
  1. vundefined
  2. 如果 iteratorRecord.[[Done]]false,则
    1. next 为 ? IteratorStepValue(iteratorRecord)。
    2. 如果 next 不是 done,则
      1. vnext
  3. 如果 Initializer 存在且 vundefined,则
    1. defaultValue 为 ? Initializer 的 Evaluation。
    2. v 为 ? GetValue(defaultValue)。
  4. 返回 ? BindingPattern 的 BindingInitialization(参数 v, environment)。
BindingRestElement : ... BindingIdentifier
  1. lhs 为 ? ResolveBinding(StringValue of BindingIdentifier, environment)。
  2. A 为 ! ArrayCreate(0)。
  3. n 为 0。
  4. 重复,
    1. nextdone
    2. 如果 iteratorRecord.[[Done]]false,则
      1. next 为 ? IteratorStepValue(iteratorRecord)。
    3. 如果 nextdone,则
      1. 如果 environmentundefined,返回 ? PutValue(lhs, A)。
      2. 返回 ? InitializeReferencedBinding(lhs, A)。
    4. 执行 ! CreateDataPropertyOrThrow(A, ! ToString(𝔽(n)), next)。
    5. nn + 1。
BindingRestElement : ... BindingPattern
  1. A 为 ! ArrayCreate(0)。
  2. n 为 0。
  3. 重复,
    1. nextdone
    2. 如果 iteratorRecord.[[Done]]false,则
      1. next 为 ? IteratorStepValue(iteratorRecord)。
    3. 如果 nextdone,则
      1. 返回 ? BindingPattern 的 BindingInitialization(参数 A, environment)。
    4. 执行 ! CreateDataPropertyOrThrow(A, ! ToString(𝔽(n)), next)。
    5. nn + 1。
FormalParameters : [empty]
  1. 返回 unused
FormalParameters : FormalParameterList , FunctionRestParameter
  1. 执行 ? FormalParameterList 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
  2. 返回 ? FunctionRestParameter 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
FormalParameterList : FormalParameterList , FormalParameter
  1. 执行 ? FormalParameterList 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
  2. 返回 ? FormalParameter 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
ArrowParameters : BindingIdentifier
  1. vundefined
  2. 断言:iteratorRecord.[[Done]]false
  3. next 为 ? IteratorStepValue(iteratorRecord)。
  4. 如果 next 不是 done,则
    1. vnext
  5. 返回 ? BindingIdentifier 的 BindingInitialization(参数 v, environment)。
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
  1. formalsCoverParenthesizedExpressionAndArrowParameterList覆盖ArrowFormalParameters
  2. 返回 ? formals 的 IteratorBindingInitialization(参数 iteratorRecord, environment)。
AsyncArrowBindingIdentifier : BindingIdentifier
  1. vundefined
  2. 断言:iteratorRecord.[[Done]]false
  3. next 为 ? IteratorStepValue(iteratorRecord)。
  4. 如果 next 不是 done,则
    1. vnext
  5. 返回 ? BindingIdentifier 的 BindingInitialization(参数 v, environment)。

8.6.4 静态语义:AssignmentTargetType

The syntax-directed operation 静态语义:AssignmentTargetType takes no arguments and returns simpleweb-compatinvalid. It is defined piecewise over the following productions:

IdentifierReference : Identifier
  1. 如果 IsStrict(this IdentifierReference) 为 trueIdentifier 的 StringValue 是 "eval""arguments",返回 invalid
  2. 返回 simple
IdentifierReference : yield await CallExpression : CallExpression [ Expression ] CallExpression . IdentifierName CallExpression . PrivateIdentifier MemberExpression : MemberExpression [ Expression ] MemberExpression . IdentifierName SuperProperty MemberExpression . PrivateIdentifier
  1. 返回 simple
PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList
  1. exprCoverParenthesizedExpressionAndArrowParameterList覆盖ParenthesizedExpression
  2. 返回 expr 的 AssignmentTargetType。
CallExpression : CoverCallExpressionAndAsyncArrowHead CallExpression Arguments
  1. Normative Optional
    如果宿主是 Web 浏览器或以其他方式支持 函数调用赋值目标的运行时错误 且 IsStrict(this CallExpression) 为 false,则
    1. 返回 web-compat
  2. 返回 invalid
PrimaryExpression : this Literal ArrayLiteral ObjectLiteral FunctionExpression ClassExpression GeneratorExpression AsyncFunctionExpression AsyncGeneratorExpression RegularExpressionLiteral TemplateLiteral CallExpression : SuperCall ImportCall CallExpression TemplateLiteral NewExpression : new NewExpression MemberExpression : MemberExpression TemplateLiteral new MemberExpression Arguments NewTarget : new . target ImportMeta : import . meta LeftHandSideExpression : OptionalExpression UpdateExpression : LeftHandSideExpression ++ LeftHandSideExpression -- ++ UnaryExpression -- UnaryExpression UnaryExpression : delete UnaryExpression void UnaryExpression typeof UnaryExpression + UnaryExpression - UnaryExpression ~ UnaryExpression ! UnaryExpression AwaitExpression ExponentiationExpression : UpdateExpression ** ExponentiationExpression MultiplicativeExpression : MultiplicativeExpression MultiplicativeOperator ExponentiationExpression AdditiveExpression : AdditiveExpression + MultiplicativeExpression AdditiveExpression - MultiplicativeExpression ShiftExpression : ShiftExpression << AdditiveExpression ShiftExpression >> AdditiveExpression ShiftExpression >>> AdditiveExpression RelationalExpression : RelationalExpression < ShiftExpression RelationalExpression > ShiftExpression RelationalExpression <= ShiftExpression RelationalExpression >= ShiftExpression RelationalExpression instanceof ShiftExpression RelationalExpression in ShiftExpression PrivateIdentifier in ShiftExpression EqualityExpression : EqualityExpression == RelationalExpression EqualityExpression != RelationalExpression EqualityExpression === RelationalExpression EqualityExpression !== RelationalExpression BitwiseANDExpression : BitwiseANDExpression & EqualityExpression BitwiseXORExpression : BitwiseXORExpression ^ BitwiseANDExpression BitwiseORExpression : BitwiseORExpression | BitwiseXORExpression LogicalANDExpression : LogicalANDExpression && BitwiseORExpression LogicalORExpression : LogicalORExpression || LogicalANDExpression CoalesceExpression : CoalesceExpressionHead ?? BitwiseORExpression ConditionalExpression : ShortCircuitExpression ? AssignmentExpression : AssignmentExpression AssignmentExpression : YieldExpression ArrowFunction AsyncArrowFunction LeftHandSideExpression = AssignmentExpression LeftHandSideExpression AssignmentOperator AssignmentExpression LeftHandSideExpression &&= AssignmentExpression LeftHandSideExpression ||= AssignmentExpression LeftHandSideExpression ??= AssignmentExpression Expression : Expression , AssignmentExpression
  1. 返回 invalid

8.6.5 静态语义:PropName

The syntax-directed operation 静态语义:PropName takes no arguments and returns 一个 String 或 empty. It is defined piecewise over the following productions:

PropertyDefinition : IdentifierReference
  1. 返回 IdentifierReference 的 StringValue。
PropertyDefinition : ... AssignmentExpression
  1. 返回 empty
PropertyDefinition : PropertyName : AssignmentExpression
  1. 返回 PropertyName 的 PropName。
LiteralPropertyName : IdentifierName AttributeKey : IdentifierName
  1. 返回 IdentifierName 的 StringValue。
LiteralPropertyName : StringLiteral AttributeKey : StringLiteral
  1. 返回 StringLiteral 的 SV。
LiteralPropertyName : NumericLiteral
  1. nbrNumericLiteral 的 NumericValue。
  2. 返回 ! ToString(nbr)。
ComputedPropertyName : [ AssignmentExpression ]
  1. 返回 empty
MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody } get ClassElementName ( ) { FunctionBody } set ClassElementName ( PropertySetParameterList ) { FunctionBody }
  1. 返回 ClassElementName 的 PropName。
GeneratorMethod : * ClassElementName ( UniqueFormalParameters ) { GeneratorBody }
  1. 返回 ClassElementName 的 PropName。
AsyncGeneratorMethod : async * ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody }
  1. 返回 ClassElementName 的 PropName。
ClassElement : ClassStaticBlock
  1. 返回 empty
ClassElement : ;
  1. 返回 empty
AsyncMethod : async ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody }
  1. 返回 ClassElementName 的 PropName。
FieldDefinition : ClassElementName Initializeropt
  1. 返回 ClassElementName 的 PropName。
ClassElementName : PrivateIdentifier
  1. 返回 empty