8 구문 지시 연산

이 절에서 정의된 것들 외에도, 특수화된 구문 지시 연산들이 이 명세 전반에 걸쳐 정의된다.

8.1 Runtime Semantics: Evaluation

The syntax-directed operation Evaluation takes no arguments and returns a Completion Record.

Note
이 연산의 정의들은 이 명세의 "ECMAScript Language" 절들에 분산되어 있다. 각 정의는 관련 production의 정의 위치 뒤에 나타난다.

8.2 스코프 분석

8.2.1 Static Semantics: BoundNames

The syntax-directed operation BoundNames takes no arguments and returns a List of Strings.

Note

"*default*"는 이 명세에서, 모듈의 기본 export가 다른 이름을 가지지 않을 때 그 기본 export를 위한 합성 이름으로 사용된다. 모듈의 [[Environment]] 안에는 그 이름으로 엔트리가 생성되어 대응하는 값을 보관하며, 그 모듈에 대해 ResolveExport ( exportName [ , resolveSet ] )를 호출하여 "default"라는 이름의 export를 해석하면 [[BindingName]]"*default*"인 ResolvedBinding Record를 반환하게 되고, 이는 다시 모듈의 [[Environment]] 안에서 위에서 언급한 값으로 해석된다. 이것은 익명 기본 export도 다른 export와 마찬가지로 해석될 수 있게 하기 위한, 순전히 명세 편의상의 처리이다. 이 "*default*" 문자열은 ECMAScript 코드나 모듈 링크 알고리즘에서 결코 접근할 수 없다.

It is defined piecewise over the following productions:

BindingIdentifier : Identifier
  1. 유일한 요소가 IdentifierStringValueList를 반환한다.
BindingIdentifier : yield
  1. « "yield" »를 반환한다.
BindingIdentifier : await
  1. « "await" »를 반환한다.
LexicalDeclaration : LetOrConst BindingList ;
  1. BindingListBoundNames를 반환한다.
BindingList : BindingList , LexicalBinding
  1. names1BindingListBoundNames라고 하자.
  2. names2LexicalBindingBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
LexicalBinding : BindingIdentifier Initializeropt
  1. BindingIdentifierBoundNames를 반환한다.
LexicalBinding : BindingPattern Initializer
  1. BindingPatternBoundNames를 반환한다.
VariableDeclarationList : VariableDeclarationList , VariableDeclaration
  1. names1VariableDeclarationListBoundNames라고 하자.
  2. names2VariableDeclarationBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
VariableDeclaration : BindingIdentifier Initializeropt
  1. BindingIdentifierBoundNames를 반환한다.
VariableDeclaration : BindingPattern Initializer
  1. BindingPatternBoundNames를 반환한다.
ObjectBindingPattern : { }
  1. 새로운 빈 List를 반환한다.
ObjectBindingPattern : { BindingPropertyList , BindingRestProperty }
  1. names1BindingPropertyListBoundNames라고 하자.
  2. names2BindingRestPropertyBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
ArrayBindingPattern : [ Elisionopt ]
  1. 새로운 빈 List를 반환한다.
ArrayBindingPattern : [ Elisionopt BindingRestElement ]
  1. BindingRestElementBoundNames를 반환한다.
ArrayBindingPattern : [ BindingElementList , Elisionopt ]
  1. BindingElementListBoundNames를 반환한다.
ArrayBindingPattern : [ BindingElementList , Elisionopt BindingRestElement ]
  1. names1BindingElementListBoundNames라고 하자.
  2. names2BindingRestElementBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
BindingPropertyList : BindingPropertyList , BindingProperty
  1. names1BindingPropertyListBoundNames라고 하자.
  2. names2BindingPropertyBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
BindingElementList : BindingElementList , BindingElisionElement
  1. names1BindingElementListBoundNames라고 하자.
  2. names2BindingElisionElementBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
BindingElisionElement : Elisionopt BindingElement
  1. BindingElementBoundNames를 반환한다.
BindingProperty : PropertyName : BindingElement
  1. BindingElementBoundNames를 반환한다.
SingleNameBinding : BindingIdentifier Initializeropt
  1. BindingIdentifierBoundNames를 반환한다.
BindingElement : BindingPattern Initializeropt
  1. BindingPatternBoundNames를 반환한다.
ForDeclaration : LetOrConst ForBinding
  1. ForBindingBoundNames를 반환한다.
FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
  1. BindingIdentifierBoundNames를 반환한다.
FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
  1. « "*default*" »를 반환한다.
FormalParameters : [empty]
  1. 새로운 빈 List를 반환한다.
FormalParameters : FormalParameterList , FunctionRestParameter
  1. names1FormalParameterListBoundNames라고 하자.
  2. names2FunctionRestParameterBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
FormalParameterList : FormalParameterList , FormalParameter
  1. names1FormalParameterListBoundNames라고 하자.
  2. names2FormalParameterBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
  1. formalsCoverParenthesizedExpressionAndArrowParameterList가 덮고 있는 ArrowFormalParameters라고 하자.
  2. formalsBoundNames를 반환한다.
GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
  1. BindingIdentifierBoundNames를 반환한다.
GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
  1. « "*default*" »를 반환한다.
AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
  1. BindingIdentifierBoundNames를 반환한다.
AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
  1. « "*default*" »를 반환한다.
ClassDeclaration : class BindingIdentifier ClassTail
  1. BindingIdentifierBoundNames를 반환한다.
ClassDeclaration : class ClassTail
  1. « "*default*" »를 반환한다.
AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
  1. BindingIdentifierBoundNames를 반환한다.
AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
  1. « "*default*" »를 반환한다.
CoverCallExpressionAndAsyncArrowHead : MemberExpression Arguments
  1. headCoverCallExpressionAndAsyncArrowHead가 덮고 있는 AsyncArrowHead라고 하자.
  2. headBoundNames를 반환한다.
ImportDeclaration : import ImportClause FromClause WithClauseopt ;
  1. ImportClauseBoundNames를 반환한다.
ImportDeclaration : import ModuleSpecifier WithClauseopt ;
  1. 새로운 빈 List를 반환한다.
ImportClause : ImportedDefaultBinding , NameSpaceImport
  1. names1ImportedDefaultBindingBoundNames라고 하자.
  2. names2NameSpaceImportBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
ImportClause : ImportedDefaultBinding , NamedImports
  1. names1ImportedDefaultBindingBoundNames라고 하자.
  2. names2NamedImportsBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
NamedImports : { }
  1. 새로운 빈 List를 반환한다.
ImportsList : ImportsList , ImportSpecifier
  1. names1ImportsListBoundNames라고 하자.
  2. names2ImportSpecifierBoundNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
ImportSpecifier : ModuleExportName as ImportedBinding
  1. ImportedBindingBoundNames를 반환한다.
ExportDeclaration : export ExportFromClause FromClause WithClauseopt ; export NamedExports ;
  1. 새로운 빈 List를 반환한다.
ExportDeclaration : export VariableStatement
  1. VariableStatementBoundNames를 반환한다.
ExportDeclaration : export Declaration
  1. DeclarationBoundNames를 반환한다.
ExportDeclaration : export default HoistableDeclaration
  1. declarationNamesHoistableDeclarationBoundNames라고 하자.
  2. declarationNames"*default*" 요소를 포함하지 않으면, "*default*"declarationNames에 추가한다.
  3. declarationNames을 반환한다.
ExportDeclaration : export default ClassDeclaration
  1. declarationNamesClassDeclarationBoundNames라고 하자.
  2. declarationNames"*default*" 요소를 포함하지 않으면, "*default*"declarationNames에 추가한다.
  3. declarationNames을 반환한다.
ExportDeclaration : export default AssignmentExpression ;
  1. « "*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
  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 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 ;
  1. LetOrConstIsConstantDeclaration을 반환한다.
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 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 : { }
  1. 새로운 빈 List를 반환한다.
StatementList : StatementList StatementListItem
  1. names1StatementListLexicallyDeclaredNames라고 하자.
  2. names2StatementListItemLexicallyDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
StatementListItem : Statement
  1. Statement Statement : LabelledStatement 이면, LabelledStatementLexicallyDeclaredNames를 반환한다.
  2. 새로운 빈 List를 반환한다.
StatementListItem : Declaration
  1. DeclarationBoundNames를 반환한다.
CaseBlock : { }
  1. 새로운 빈 List를 반환한다.
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 첫 번째 CaseClauses가 존재하면, names1을 첫 번째 CaseClausesLexicallyDeclaredNames라고 하자.
  2. 그렇지 않으면, names1을 새로운 빈 List라고 하자.
  3. names2DefaultClauseLexicallyDeclaredNames라고 하자.
  4. 두 번째 CaseClauses가 존재하면, names3을 두 번째 CaseClausesLexicallyDeclaredNames라고 하자.
  5. 그렇지 않으면, names3을 새로운 빈 List라고 하자.
  6. names1, names2, names3list-concatenation을 반환한다.
CaseClauses : CaseClauses CaseClause
  1. names1CaseClausesLexicallyDeclaredNames라고 하자.
  2. names2CaseClauseLexicallyDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
CaseClause : case Expression : StatementListopt
  1. StatementList가 존재하면, StatementListLexicallyDeclaredNames를 반환한다.
  2. 새로운 빈 List를 반환한다.
DefaultClause : default : StatementListopt
  1. StatementList가 존재하면, StatementListLexicallyDeclaredNames를 반환한다.
  2. 새로운 빈 List를 반환한다.
LabelledStatement : LabelIdentifier : LabelledItem
  1. LabelledItemLexicallyDeclaredNames를 반환한다.
LabelledItem : Statement
  1. 새로운 빈 List를 반환한다.
LabelledItem : FunctionDeclaration
  1. FunctionDeclarationBoundNames를 반환한다.
FunctionStatementList : [empty]
  1. 새로운 빈 List를 반환한다.
FunctionStatementList : StatementList
  1. StatementListTopLevelLexicallyDeclaredNames를 반환한다.
ClassStaticBlockStatementList : [empty]
  1. 새로운 빈 List를 반환한다.
ClassStaticBlockStatementList : StatementList
  1. StatementListTopLevelLexicallyDeclaredNames를 반환한다.
ConciseBody : ExpressionBody
  1. 새로운 빈 List를 반환한다.
AsyncConciseBody : ExpressionBody
  1. 새로운 빈 List를 반환한다.
Script : [empty]
  1. 새로운 빈 List를 반환한다.
ScriptBody : StatementList
  1. StatementListTopLevelLexicallyDeclaredNames를 반환한다.
Note 1

Script의 최상위 수준에서는 함수 선언이 lexical declaration처럼 아니라 var declaration처럼 취급된다.

Note 2

Module의 LexicallyDeclaredNames에는 그 모듈의 모든 imported binding 이름이 포함된다.

ModuleItemList : ModuleItemList ModuleItem
  1. names1ModuleItemListLexicallyDeclaredNames라고 하자.
  2. names2ModuleItemLexicallyDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
ModuleItem : ImportDeclaration
  1. ImportDeclarationBoundNames를 반환한다.
ModuleItem : ExportDeclaration
  1. ExportDeclarationexport VariableStatement이면, 새로운 빈 List를 반환한다.
  2. ExportDeclarationBoundNames를 반환한다.
ModuleItem : StatementListItem
  1. StatementListItemLexicallyDeclaredNames를 반환한다.
Note 3

Module의 최상위 수준에서는 함수 선언이 var declaration처럼이 아니라 lexical declaration처럼 취급된다.

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
  1. declarations1StatementListLexicallyScopedDeclarations라고 하자.
  2. declarations2StatementListItemLexicallyScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
StatementListItem : Statement
  1. Statement Statement : LabelledStatement 이면, LabelledStatementLexicallyScopedDeclarations를 반환한다.
  2. 새로운 빈 List를 반환한다.
StatementListItem : Declaration
  1. 유일한 요소가 DeclarationDeclarationPartList를 반환한다.
CaseBlock : { }
  1. 새로운 빈 List를 반환한다.
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 첫 번째 CaseClauses가 존재하면, declarations1을 첫 번째 CaseClausesLexicallyScopedDeclarations라고 하자.
  2. 그렇지 않으면, declarations1을 새로운 빈 List라고 하자.
  3. declarations2DefaultClauseLexicallyScopedDeclarations라고 하자.
  4. 두 번째 CaseClauses가 존재하면, declarations3을 두 번째 CaseClausesLexicallyScopedDeclarations라고 하자.
  5. 그렇지 않으면, declarations3을 새로운 빈 List라고 하자.
  6. declarations1, declarations2, declarations3list-concatenation을 반환한다.
CaseClauses : CaseClauses CaseClause
  1. declarations1CaseClausesLexicallyScopedDeclarations라고 하자.
  2. declarations2CaseClauseLexicallyScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
CaseClause : case Expression : StatementListopt
  1. StatementList가 존재하면, StatementListLexicallyScopedDeclarations를 반환한다.
  2. 새로운 빈 List를 반환한다.
DefaultClause : default : StatementListopt
  1. StatementList가 존재하면, StatementListLexicallyScopedDeclarations를 반환한다.
  2. 새로운 빈 List를 반환한다.
LabelledStatement : LabelIdentifier : LabelledItem
  1. LabelledItemLexicallyScopedDeclarations를 반환한다.
LabelledItem : Statement
  1. 새로운 빈 List를 반환한다.
LabelledItem : FunctionDeclaration
  1. « FunctionDeclaration »를 반환한다.
FunctionStatementList : [empty]
  1. 새로운 빈 List를 반환한다.
FunctionStatementList : StatementList
  1. StatementListTopLevelLexicallyScopedDeclarations를 반환한다.
ClassStaticBlockStatementList : [empty]
  1. 새로운 빈 List를 반환한다.
ClassStaticBlockStatementList : StatementList
  1. StatementListTopLevelLexicallyScopedDeclarations를 반환한다.
ConciseBody : ExpressionBody
  1. 새로운 빈 List를 반환한다.
AsyncConciseBody : ExpressionBody
  1. 새로운 빈 List를 반환한다.
Script : [empty]
  1. 새로운 빈 List를 반환한다.
ScriptBody : StatementList
  1. StatementListTopLevelLexicallyScopedDeclarations를 반환한다.
Module : [empty]
  1. 새로운 빈 List를 반환한다.
ModuleItemList : ModuleItemList ModuleItem
  1. declarations1ModuleItemListLexicallyScopedDeclarations라고 하자.
  2. declarations2ModuleItemLexicallyScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
ModuleItem : ImportDeclaration
  1. 새로운 빈 List를 반환한다.
ExportDeclaration : export ExportFromClause FromClause WithClauseopt ; export NamedExports ; export VariableStatement
  1. 새로운 빈 List를 반환한다.
ExportDeclaration : export Declaration
  1. 유일한 요소가 DeclarationDeclarationPartList를 반환한다.
ExportDeclaration : export default HoistableDeclaration
  1. 유일한 요소가 HoistableDeclarationDeclarationPartList를 반환한다.
ExportDeclaration : export default ClassDeclaration
  1. 유일한 요소가 ClassDeclarationList를 반환한다.
ExportDeclaration : export default AssignmentExpression ;
  1. 유일한 요소가 이 ExportDeclarationList를 반환한다.

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
  1. 새로운 빈 List를 반환한다.
Block : { }
  1. 새로운 빈 List를 반환한다.
StatementList : StatementList StatementListItem
  1. names1StatementListVarDeclaredNames라고 하자.
  2. names2StatementListItemVarDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
StatementListItem : Declaration
  1. 새로운 빈 List를 반환한다.
VariableStatement : var VariableDeclarationList ;
  1. VariableDeclarationListBoundNames를 반환한다.
IfStatement : if ( Expression ) Statement else Statement
  1. names1을 첫 번째 StatementVarDeclaredNames라고 하자.
  2. names2를 두 번째 StatementVarDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
IfStatement : if ( Expression ) Statement
  1. StatementVarDeclaredNames를 반환한다.
DoWhileStatement : do Statement while ( Expression ) ;
  1. StatementVarDeclaredNames를 반환한다.
WhileStatement : while ( Expression ) Statement
  1. StatementVarDeclaredNames를 반환한다.
ForStatement : for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement
  1. StatementVarDeclaredNames를 반환한다.
ForStatement : for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
  1. names1VariableDeclarationListBoundNames라고 하자.
  2. names2StatementVarDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
ForStatement : for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
  1. StatementVarDeclaredNames를 반환한다.
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. StatementVarDeclaredNames를 반환한다.
ForInOfStatement : for ( var ForBinding in Expression ) Statement for ( var ForBinding of AssignmentExpression ) Statement for await ( var ForBinding of AssignmentExpression ) Statement
  1. names1ForBindingBoundNames라고 하자.
  2. names2StatementVarDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
Note

이 절은 부록 B.3.5 에 의해 확장된다.

WithStatement : with ( Expression ) Statement
  1. StatementVarDeclaredNames를 반환한다.
SwitchStatement : switch ( Expression ) CaseBlock
  1. CaseBlockVarDeclaredNames를 반환한다.
CaseBlock : { }
  1. 새로운 빈 List를 반환한다.
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 첫 번째 CaseClauses가 존재하면, names1을 첫 번째 CaseClausesVarDeclaredNames라고 하자.
  2. 그렇지 않으면, names1을 새로운 빈 List라고 하자.
  3. names2DefaultClauseVarDeclaredNames라고 하자.
  4. 두 번째 CaseClauses가 존재하면, names3을 두 번째 CaseClausesVarDeclaredNames라고 하자.
  5. 그렇지 않으면, names3을 새로운 빈 List라고 하자.
  6. names1, names2, names3list-concatenation을 반환한다.
CaseClauses : CaseClauses CaseClause
  1. names1CaseClausesVarDeclaredNames라고 하자.
  2. names2CaseClauseVarDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
CaseClause : case Expression : StatementListopt
  1. StatementList가 존재하면, StatementListVarDeclaredNames를 반환한다.
  2. 새로운 빈 List를 반환한다.
DefaultClause : default : StatementListopt
  1. StatementList가 존재하면, StatementListVarDeclaredNames를 반환한다.
  2. 새로운 빈 List를 반환한다.
LabelledStatement : LabelIdentifier : LabelledItem
  1. LabelledItemVarDeclaredNames를 반환한다.
LabelledItem : FunctionDeclaration
  1. 새로운 빈 List를 반환한다.
TryStatement : try Block Catch
  1. names1BlockVarDeclaredNames라고 하자.
  2. names2CatchVarDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
TryStatement : try Block Finally
  1. names1BlockVarDeclaredNames라고 하자.
  2. names2FinallyVarDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
TryStatement : try Block Catch Finally
  1. names1BlockVarDeclaredNames라고 하자.
  2. names2CatchVarDeclaredNames라고 하자.
  3. names3FinallyVarDeclaredNames라고 하자.
  4. names1, names2, names3list-concatenation을 반환한다.
Catch : catch ( CatchParameter ) Block
  1. BlockVarDeclaredNames를 반환한다.
FunctionStatementList : [empty]
  1. 새로운 빈 List를 반환한다.
FunctionStatementList : StatementList
  1. StatementListTopLevelVarDeclaredNames를 반환한다.
ClassStaticBlockStatementList : [empty]
  1. 새로운 빈 List를 반환한다.
ClassStaticBlockStatementList : StatementList
  1. StatementListTopLevelVarDeclaredNames를 반환한다.
ConciseBody : ExpressionBody
  1. 새로운 빈 List를 반환한다.
AsyncConciseBody : ExpressionBody
  1. 새로운 빈 List를 반환한다.
Script : [empty]
  1. 새로운 빈 List를 반환한다.
ScriptBody : StatementList
  1. StatementListTopLevelVarDeclaredNames를 반환한다.
ModuleItemList : ModuleItemList ModuleItem
  1. names1ModuleItemListVarDeclaredNames라고 하자.
  2. names2ModuleItemVarDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
ModuleItem : ImportDeclaration
  1. 새로운 빈 List를 반환한다.
ModuleItem : ExportDeclaration
  1. ExportDeclarationexport VariableStatement이면, ExportDeclarationBoundNames를 반환한다.
  2. 새로운 빈 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
  1. 새로운 빈 List를 반환한다.
Block : { }
  1. 새로운 빈 List를 반환한다.
StatementList : StatementList StatementListItem
  1. declarations1StatementListVarScopedDeclarations라고 하자.
  2. declarations2StatementListItemVarScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
StatementListItem : Declaration
  1. 새로운 빈 List를 반환한다.
VariableDeclarationList : VariableDeclaration
  1. « VariableDeclaration »를 반환한다.
VariableDeclarationList : VariableDeclarationList , VariableDeclaration
  1. declarations1VariableDeclarationListVarScopedDeclarations라고 하자.
  2. declarations1과 « VariableDeclaration »의 list-concatenation을 반환한다.
IfStatement : if ( Expression ) Statement else Statement
  1. declarations1을 첫 번째 StatementVarScopedDeclarations라고 하자.
  2. declarations2를 두 번째 StatementVarScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
IfStatement : if ( Expression ) Statement
  1. StatementVarScopedDeclarations를 반환한다.
DoWhileStatement : do Statement while ( Expression ) ;
  1. StatementVarScopedDeclarations를 반환한다.
WhileStatement : while ( Expression ) Statement
  1. StatementVarScopedDeclarations를 반환한다.
ForStatement : for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement
  1. StatementVarScopedDeclarations를 반환한다.
ForStatement : for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
  1. declarations1VariableDeclarationListVarScopedDeclarations라고 하자.
  2. declarations2StatementVarScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
ForStatement : for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
  1. StatementVarScopedDeclarations를 반환한다.
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. StatementVarScopedDeclarations를 반환한다.
ForInOfStatement : for ( var ForBinding in Expression ) Statement for ( var ForBinding of AssignmentExpression ) Statement for await ( var ForBinding of AssignmentExpression ) Statement
  1. declarations1을 « ForBinding »라고 하자.
  2. declarations2StatementVarScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
Note

이 절은 부록 B.3.5 에 의해 확장된다.

WithStatement : with ( Expression ) Statement
  1. StatementVarScopedDeclarations를 반환한다.
SwitchStatement : switch ( Expression ) CaseBlock
  1. CaseBlockVarScopedDeclarations를 반환한다.
CaseBlock : { }
  1. 새로운 빈 List를 반환한다.
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 첫 번째 CaseClauses가 존재하면, declarations1을 첫 번째 CaseClausesVarScopedDeclarations라고 하자.
  2. 그렇지 않으면, declarations1을 새로운 빈 List라고 하자.
  3. declarations2DefaultClauseVarScopedDeclarations라고 하자.
  4. 두 번째 CaseClauses가 존재하면, declarations3을 두 번째 CaseClausesVarScopedDeclarations라고 하자.
  5. 그렇지 않으면, declarations3을 새로운 빈 List라고 하자.
  6. declarations1, declarations2, declarations3list-concatenation을 반환한다.
CaseClauses : CaseClauses CaseClause
  1. declarations1CaseClausesVarScopedDeclarations라고 하자.
  2. declarations2CaseClauseVarScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
CaseClause : case Expression : StatementListopt
  1. StatementList가 존재하면, StatementListVarScopedDeclarations를 반환한다.
  2. 새로운 빈 List를 반환한다.
DefaultClause : default : StatementListopt
  1. StatementList가 존재하면, StatementListVarScopedDeclarations를 반환한다.
  2. 새로운 빈 List를 반환한다.
LabelledStatement : LabelIdentifier : LabelledItem
  1. LabelledItemVarScopedDeclarations를 반환한다.
LabelledItem : FunctionDeclaration
  1. 새로운 빈 List를 반환한다.
TryStatement : try Block Catch
  1. declarations1BlockVarScopedDeclarations라고 하자.
  2. declarations2CatchVarScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
TryStatement : try Block Finally
  1. declarations1BlockVarScopedDeclarations라고 하자.
  2. declarations2FinallyVarScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
TryStatement : try Block Catch Finally
  1. declarations1BlockVarScopedDeclarations라고 하자.
  2. declarations2CatchVarScopedDeclarations라고 하자.
  3. declarations3FinallyVarScopedDeclarations라고 하자.
  4. declarations1, declarations2, declarations3list-concatenation을 반환한다.
Catch : catch ( CatchParameter ) Block
  1. BlockVarScopedDeclarations를 반환한다.
FunctionStatementList : [empty]
  1. 새로운 빈 List를 반환한다.
FunctionStatementList : StatementList
  1. StatementListTopLevelVarScopedDeclarations를 반환한다.
ClassStaticBlockStatementList : [empty]
  1. 새로운 빈 List를 반환한다.
ClassStaticBlockStatementList : StatementList
  1. StatementListTopLevelVarScopedDeclarations를 반환한다.
ConciseBody : ExpressionBody
  1. 새로운 빈 List를 반환한다.
AsyncConciseBody : ExpressionBody
  1. 새로운 빈 List를 반환한다.
Script : [empty]
  1. 새로운 빈 List를 반환한다.
ScriptBody : StatementList
  1. StatementListTopLevelVarScopedDeclarations를 반환한다.
Module : [empty]
  1. 새로운 빈 List를 반환한다.
ModuleItemList : ModuleItemList ModuleItem
  1. declarations1ModuleItemListVarScopedDeclarations라고 하자.
  2. declarations2ModuleItemVarScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
ModuleItem : ImportDeclaration
  1. 새로운 빈 List를 반환한다.
ModuleItem : ExportDeclaration
  1. ExportDeclarationexport VariableStatement이면, VariableStatementVarScopedDeclarations를 반환한다.
  2. 새로운 빈 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
  1. names1StatementListTopLevelLexicallyDeclaredNames라고 하자.
  2. names2StatementListItemTopLevelLexicallyDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
StatementListItem : Statement
  1. 새로운 빈 List를 반환한다.
StatementListItem : Declaration
  1. Declaration Declaration : HoistableDeclaration 이면,
    1. 새로운 빈 List를 반환한다.
  2. DeclarationBoundNames를 반환한다.
Note

함수나 스크립트의 최상위 수준에서는 함수 선언이 lexical declaration처럼이 아니라 var declaration처럼 취급된다.

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
  1. declarations1StatementListTopLevelLexicallyScopedDeclarations라고 하자.
  2. declarations2StatementListItemTopLevelLexicallyScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
StatementListItem : Statement
  1. 새로운 빈 List를 반환한다.
StatementListItem : Declaration
  1. Declaration Declaration : HoistableDeclaration 이면,
    1. 새로운 빈 List를 반환한다.
  2. « 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
  1. names1StatementListTopLevelVarDeclaredNames라고 하자.
  2. names2StatementListItemTopLevelVarDeclaredNames라고 하자.
  3. names1names2list-concatenation을 반환한다.
StatementListItem : Declaration
  1. Declaration Declaration : HoistableDeclaration 이면,
    1. HoistableDeclarationBoundNames를 반환한다.
  2. 새로운 빈 List를 반환한다.
StatementListItem : Statement
  1. Statement Statement : LabelledStatement 이면, StatementTopLevelVarDeclaredNames를 반환한다.
  2. StatementVarDeclaredNames를 반환한다.
Note

함수나 스크립트의 최상위 수준에서는 내부 함수 선언이 var declaration처럼 취급된다.

LabelledStatement : LabelIdentifier : LabelledItem
  1. LabelledItemTopLevelVarDeclaredNames를 반환한다.
LabelledItem : Statement
  1. Statement Statement : LabelledStatement 이면, StatementTopLevelVarDeclaredNames를 반환한다.
  2. StatementVarDeclaredNames를 반환한다.
LabelledItem : FunctionDeclaration
  1. FunctionDeclarationBoundNames를 반환한다.

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
  1. declarations1StatementListTopLevelVarScopedDeclarations라고 하자.
  2. declarations2StatementListItemTopLevelVarScopedDeclarations라고 하자.
  3. declarations1declarations2list-concatenation을 반환한다.
StatementListItem : Statement
  1. Statement Statement : LabelledStatement 이면, StatementTopLevelVarScopedDeclarations를 반환한다.
  2. StatementVarScopedDeclarations를 반환한다.
StatementListItem : Declaration
  1. Declaration Declaration : HoistableDeclaration 이면,
    1. declarationHoistableDeclarationDeclarationPart라고 하자.
    2. « declaration »를 반환한다.
  2. 새로운 빈 List를 반환한다.
LabelledStatement : LabelIdentifier : LabelledItem
  1. LabelledItemTopLevelVarScopedDeclarations를 반환한다.
LabelledItem : Statement
  1. Statement Statement : LabelledStatement 이면, StatementTopLevelVarScopedDeclarations를 반환한다.
  2. StatementVarScopedDeclarations를 반환한다.
LabelledItem : FunctionDeclaration
  1. « FunctionDeclaration »를 반환한다.

8.3 레이블

8.3.1 Static Semantics: ContainsDuplicateLabels

The syntax-directed operation ContainsDuplicateLabels takes argument labelSet (a List of Strings) and returns a 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. hasDuplicates를 인수 labelSet을 사용한 StatementListContainsDuplicateLabels라고 하자.
  2. hasDuplicatestrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 StatementListItemContainsDuplicateLabels를 반환한다.
IfStatement : if ( Expression ) Statement else Statement
  1. hasDuplicate를 인수 labelSet을 사용한 첫 번째 StatementContainsDuplicateLabels라고 하자.
  2. hasDuplicatetrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 두 번째 StatementContainsDuplicateLabels를 반환한다.
IfStatement : if ( Expression ) Statement
  1. 인수 labelSet을 사용한 StatementContainsDuplicateLabels를 반환한다.
DoWhileStatement : do Statement while ( Expression ) ;
  1. 인수 labelSet을 사용한 StatementContainsDuplicateLabels를 반환한다.
WhileStatement : while ( Expression ) Statement
  1. 인수 labelSet을 사용한 StatementContainsDuplicateLabels를 반환한다.
ForStatement : for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
  1. 인수 labelSet을 사용한 StatementContainsDuplicateLabels를 반환한다.
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. 인수 labelSet을 사용한 StatementContainsDuplicateLabels를 반환한다.
Note

이 절은 부록 B.3.5 에 의해 확장된다.

WithStatement : with ( Expression ) Statement
  1. 인수 labelSet을 사용한 StatementContainsDuplicateLabels를 반환한다.
SwitchStatement : switch ( Expression ) CaseBlock
  1. 인수 labelSet을 사용한 CaseBlockContainsDuplicateLabels를 반환한다.
CaseBlock : { }
  1. false를 반환한다.
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 첫 번째 CaseClauses가 존재하면,
    1. 인수 labelSet을 사용한 첫 번째 CaseClausesContainsDuplicateLabelstrue이면, true를 반환한다.
  2. 인수 labelSet을 사용한 DefaultClauseContainsDuplicateLabelstrue이면, true를 반환한다.
  3. 두 번째 CaseClauses가 존재하지 않으면, false를 반환한다.
  4. 인수 labelSet을 사용한 두 번째 CaseClausesContainsDuplicateLabels를 반환한다.
CaseClauses : CaseClauses CaseClause
  1. hasDuplicates를 인수 labelSet을 사용한 CaseClausesContainsDuplicateLabels라고 하자.
  2. hasDuplicatestrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 CaseClauseContainsDuplicateLabels를 반환한다.
CaseClause : case Expression : StatementListopt
  1. StatementList가 존재하면, 인수 labelSet을 사용한 StatementListContainsDuplicateLabels를 반환한다.
  2. false를 반환한다.
DefaultClause : default : StatementListopt
  1. StatementList가 존재하면, 인수 labelSet을 사용한 StatementListContainsDuplicateLabels를 반환한다.
  2. false를 반환한다.
LabelledStatement : LabelIdentifier : LabelledItem
  1. labelLabelIdentifierStringValue라고 하자.
  2. labelSetlabel을 포함하면, true를 반환한다.
  3. newLabelSetlabelSet과 « label »의 list-concatenation이라고 하자.
  4. 인수 newLabelSet을 사용한 LabelledItemContainsDuplicateLabels를 반환한다.
LabelledItem : FunctionDeclaration
  1. false를 반환한다.
TryStatement : try Block Catch
  1. hasDuplicates를 인수 labelSet을 사용한 BlockContainsDuplicateLabels라고 하자.
  2. hasDuplicatestrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 CatchContainsDuplicateLabels를 반환한다.
TryStatement : try Block Finally
  1. hasDuplicates를 인수 labelSet을 사용한 BlockContainsDuplicateLabels라고 하자.
  2. hasDuplicatestrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 FinallyContainsDuplicateLabels를 반환한다.
TryStatement : try Block Catch Finally
  1. 인수 labelSet을 사용한 BlockContainsDuplicateLabelstrue이면, true를 반환한다.
  2. 인수 labelSet을 사용한 CatchContainsDuplicateLabelstrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 FinallyContainsDuplicateLabels를 반환한다.
Catch : catch ( CatchParameter ) Block
  1. 인수 labelSet을 사용한 BlockContainsDuplicateLabels를 반환한다.
FunctionStatementList : [empty]
  1. false를 반환한다.
ClassStaticBlockStatementList : [empty]
  1. false를 반환한다.
ModuleItemList : ModuleItemList ModuleItem
  1. hasDuplicates를 인수 labelSet을 사용한 ModuleItemListContainsDuplicateLabels라고 하자.
  2. hasDuplicatestrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 ModuleItemContainsDuplicateLabels를 반환한다.
ModuleItem : ImportDeclaration ExportDeclaration
  1. false를 반환한다.

8.3.2 Static Semantics: ContainsUndefinedBreakTarget

The syntax-directed operation ContainsUndefinedBreakTarget takes argument labelSet (a List of Strings) and returns a 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. hasUndefinedLabels를 인수 labelSet을 사용한 StatementListContainsUndefinedBreakTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 StatementListItemContainsUndefinedBreakTarget을 반환한다.
IfStatement : if ( Expression ) Statement else Statement
  1. hasUndefinedLabels를 인수 labelSet을 사용한 첫 번째 StatementContainsUndefinedBreakTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 두 번째 StatementContainsUndefinedBreakTarget을 반환한다.
IfStatement : if ( Expression ) Statement
  1. 인수 labelSet을 사용한 StatementContainsUndefinedBreakTarget을 반환한다.
DoWhileStatement : do Statement while ( Expression ) ;
  1. 인수 labelSet을 사용한 StatementContainsUndefinedBreakTarget을 반환한다.
WhileStatement : while ( Expression ) Statement
  1. 인수 labelSet을 사용한 StatementContainsUndefinedBreakTarget을 반환한다.
ForStatement : for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
  1. 인수 labelSet을 사용한 StatementContainsUndefinedBreakTarget을 반환한다.
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. 인수 labelSet을 사용한 StatementContainsUndefinedBreakTarget을 반환한다.
Note

이 절은 부록 B.3.5 에 의해 확장된다.

BreakStatement : break ;
  1. false를 반환한다.
BreakStatement : break LabelIdentifier ;
  1. labelSetLabelIdentifierStringValue를 포함하면, false를 반환한다.
  2. true를 반환한다.
WithStatement : with ( Expression ) Statement
  1. 인수 labelSet을 사용한 StatementContainsUndefinedBreakTarget을 반환한다.
SwitchStatement : switch ( Expression ) CaseBlock
  1. 인수 labelSet을 사용한 CaseBlockContainsUndefinedBreakTarget을 반환한다.
CaseBlock : { }
  1. false를 반환한다.
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 첫 번째 CaseClauses가 존재하면,
    1. 인수 labelSet을 사용한 첫 번째 CaseClausesContainsUndefinedBreakTargettrue이면, true를 반환한다.
  2. 인수 labelSet을 사용한 DefaultClauseContainsUndefinedBreakTargettrue이면, true를 반환한다.
  3. 두 번째 CaseClauses가 존재하지 않으면, false를 반환한다.
  4. 인수 labelSet을 사용한 두 번째 CaseClausesContainsUndefinedBreakTarget을 반환한다.
CaseClauses : CaseClauses CaseClause
  1. hasUndefinedLabels를 인수 labelSet을 사용한 CaseClausesContainsUndefinedBreakTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 CaseClauseContainsUndefinedBreakTarget을 반환한다.
CaseClause : case Expression : StatementListopt
  1. StatementList가 존재하면, 인수 labelSet을 사용한 StatementListContainsUndefinedBreakTarget을 반환한다.
  2. false를 반환한다.
DefaultClause : default : StatementListopt
  1. StatementList가 존재하면, 인수 labelSet을 사용한 StatementListContainsUndefinedBreakTarget을 반환한다.
  2. false를 반환한다.
LabelledStatement : LabelIdentifier : LabelledItem
  1. labelLabelIdentifierStringValue라고 하자.
  2. newLabelSetlabelSet과 « label »의 list-concatenation이라고 하자.
  3. 인수 newLabelSet을 사용한 LabelledItemContainsUndefinedBreakTarget을 반환한다.
LabelledItem : FunctionDeclaration
  1. false를 반환한다.
TryStatement : try Block Catch
  1. hasUndefinedLabels를 인수 labelSet을 사용한 BlockContainsUndefinedBreakTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 CatchContainsUndefinedBreakTarget을 반환한다.
TryStatement : try Block Finally
  1. hasUndefinedLabels를 인수 labelSet을 사용한 BlockContainsUndefinedBreakTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 FinallyContainsUndefinedBreakTarget을 반환한다.
TryStatement : try Block Catch Finally
  1. 인수 labelSet을 사용한 BlockContainsUndefinedBreakTargettrue이면, true를 반환한다.
  2. 인수 labelSet을 사용한 CatchContainsUndefinedBreakTargettrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 FinallyContainsUndefinedBreakTarget을 반환한다.
Catch : catch ( CatchParameter ) Block
  1. 인수 labelSet을 사용한 BlockContainsUndefinedBreakTarget을 반환한다.
FunctionStatementList : [empty]
  1. false를 반환한다.
ClassStaticBlockStatementList : [empty]
  1. false를 반환한다.
ModuleItemList : ModuleItemList ModuleItem
  1. hasUndefinedLabels를 인수 labelSet을 사용한 ModuleItemListContainsUndefinedBreakTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 labelSet을 사용한 ModuleItemContainsUndefinedBreakTarget을 반환한다.
ModuleItem : ImportDeclaration ExportDeclaration
  1. false를 반환한다.

8.3.3 Static Semantics: ContainsUndefinedContinueTarget

The syntax-directed operation ContainsUndefinedContinueTarget takes arguments iterationSet (a List of Strings) and labelSet (a List of Strings) and returns a 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. 인수 iterationSet와 « »를 사용한 BlockStatementContainsUndefinedContinueTarget을 반환한다.
BreakableStatement : IterationStatement
  1. newIterationSetiterationSetlabelSetlist-concatenation이라고 하자.
  2. 인수 newIterationSet와 « »를 사용한 IterationStatementContainsUndefinedContinueTarget을 반환한다.
StatementList : StatementList StatementListItem
  1. hasUndefinedLabels를 인수 iterationSet와 « »를 사용한 StatementListContainsUndefinedContinueTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 iterationSet와 « »를 사용한 StatementListItemContainsUndefinedContinueTarget을 반환한다.
IfStatement : if ( Expression ) Statement else Statement
  1. hasUndefinedLabels를 인수 iterationSet와 « »를 사용한 첫 번째 StatementContainsUndefinedContinueTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 iterationSet와 « »를 사용한 두 번째 StatementContainsUndefinedContinueTarget을 반환한다.
IfStatement : if ( Expression ) Statement
  1. 인수 iterationSet와 « »를 사용한 StatementContainsUndefinedContinueTarget을 반환한다.
DoWhileStatement : do Statement while ( Expression ) ;
  1. 인수 iterationSet와 « »를 사용한 StatementContainsUndefinedContinueTarget을 반환한다.
WhileStatement : while ( Expression ) Statement
  1. 인수 iterationSet와 « »를 사용한 StatementContainsUndefinedContinueTarget을 반환한다.
ForStatement : for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
  1. 인수 iterationSet와 « »를 사용한 StatementContainsUndefinedContinueTarget을 반환한다.
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. 인수 iterationSet와 « »를 사용한 StatementContainsUndefinedContinueTarget을 반환한다.
Note

이 절은 부록 B.3.5 에 의해 확장된다.

ContinueStatement : continue ;
  1. false를 반환한다.
ContinueStatement : continue LabelIdentifier ;
  1. iterationSetLabelIdentifierStringValue를 포함하면, false를 반환한다.
  2. true를 반환한다.
WithStatement : with ( Expression ) Statement
  1. 인수 iterationSet와 « »를 사용한 StatementContainsUndefinedContinueTarget을 반환한다.
SwitchStatement : switch ( Expression ) CaseBlock
  1. 인수 iterationSet와 « »를 사용한 CaseBlockContainsUndefinedContinueTarget을 반환한다.
CaseBlock : { }
  1. false를 반환한다.
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
  1. 첫 번째 CaseClauses가 존재하면,
    1. 인수 iterationSet와 « »를 사용한 첫 번째 CaseClausesContainsUndefinedContinueTargettrue이면, true를 반환한다.
  2. 인수 iterationSet와 « »를 사용한 DefaultClauseContainsUndefinedContinueTargettrue이면, true를 반환한다.
  3. 두 번째 CaseClauses가 존재하지 않으면, false를 반환한다.
  4. 인수 iterationSet와 « »를 사용한 두 번째 CaseClausesContainsUndefinedContinueTarget을 반환한다.
CaseClauses : CaseClauses CaseClause
  1. hasUndefinedLabels를 인수 iterationSet와 « »를 사용한 CaseClausesContainsUndefinedContinueTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 iterationSet와 « »를 사용한 CaseClauseContainsUndefinedContinueTarget을 반환한다.
CaseClause : case Expression : StatementListopt
  1. StatementList가 존재하면, 인수 iterationSet와 « »를 사용한 StatementListContainsUndefinedContinueTarget을 반환한다.
  2. false를 반환한다.
DefaultClause : default : StatementListopt
  1. StatementList가 존재하면, 인수 iterationSet와 « »를 사용한 StatementListContainsUndefinedContinueTarget을 반환한다.
  2. false를 반환한다.
LabelledStatement : LabelIdentifier : LabelledItem
  1. labelLabelIdentifierStringValue라고 하자.
  2. newLabelSetlabelSet과 « label »의 list-concatenation이라고 하자.
  3. 인수 iterationSetnewLabelSet을 사용한 LabelledItemContainsUndefinedContinueTarget을 반환한다.
LabelledItem : FunctionDeclaration
  1. false를 반환한다.
TryStatement : try Block Catch
  1. hasUndefinedLabels를 인수 iterationSet와 « »를 사용한 BlockContainsUndefinedContinueTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 iterationSet와 « »를 사용한 CatchContainsUndefinedContinueTarget을 반환한다.
TryStatement : try Block Finally
  1. hasUndefinedLabels를 인수 iterationSet와 « »를 사용한 BlockContainsUndefinedContinueTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 iterationSet와 « »를 사용한 FinallyContainsUndefinedContinueTarget을 반환한다.
TryStatement : try Block Catch Finally
  1. 인수 iterationSet와 « »를 사용한 BlockContainsUndefinedContinueTargettrue이면, true를 반환한다.
  2. 인수 iterationSet와 « »를 사용한 CatchContainsUndefinedContinueTargettrue이면, true를 반환한다.
  3. 인수 iterationSet와 « »를 사용한 FinallyContainsUndefinedContinueTarget을 반환한다.
Catch : catch ( CatchParameter ) Block
  1. 인수 iterationSet와 « »를 사용한 BlockContainsUndefinedContinueTarget을 반환한다.
FunctionStatementList : [empty]
  1. false를 반환한다.
ClassStaticBlockStatementList : [empty]
  1. false를 반환한다.
ModuleItemList : ModuleItemList ModuleItem
  1. hasUndefinedLabels를 인수 iterationSet와 « »를 사용한 ModuleItemListContainsUndefinedContinueTarget이라고 하자.
  2. hasUndefinedLabelstrue이면, true를 반환한다.
  3. 인수 iterationSet와 « »를 사용한 ModuleItemContainsUndefinedContinueTarget을 반환한다.
ModuleItem : ImportDeclaration ExportDeclaration
  1. false를 반환한다.

8.4 함수 이름 추론

8.4.1 Static Semantics: HasName

The syntax-directed operation HasName takes no arguments and returns a Boolean. It is defined piecewise over the following productions:

PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList
  1. exprCoverParenthesizedExpressionAndArrowParameterList가 덮고 있는 ParenthesizedExpression이라고 하자.
  2. exprIsFunctionDefinitionfalse이면, false를 반환한다.
  3. exprHasName을 반환한다.
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 Static Semantics: IsFunctionDefinition

The syntax-directed operation IsFunctionDefinition takes no arguments and returns a Boolean. It is defined piecewise over the following productions:

PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList
  1. exprCoverParenthesizedExpressionAndArrowParameterList가 덮고 있는 ParenthesizedExpression이라고 하자.
  2. exprIsFunctionDefinition을 반환한다.
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 Static Semantics: IsAnonymousFunctionDefinition ( expr )

The abstract operation IsAnonymousFunctionDefinition takes argument expr (an AssignmentExpression Parse Node, an Initializer Parse Node, or an Expression Parse Node) and returns a Boolean. 이것은 자신의 인수가 이름을 바인딩하지 않는 함수 정의인지 결정한다. It performs the following steps when called:

  1. exprIsFunctionDefinitionfalse이면, false를 반환한다.
  2. hasNameexprHasName이라고 하자.
  3. hasNametrue이면, false를 반환한다.
  4. true를 반환한다.

8.4.4 Static Semantics: IsIdentifierRef

The syntax-directed operation IsIdentifierRef takes no arguments and returns a 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 Runtime Semantics: NamedEvaluation

The syntax-directed operation NamedEvaluation takes argument name (a property key or a Private Name) and returns either a normal completion containing a function object or an abrupt completion. It is defined piecewise over the following productions:

PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList
  1. exprCoverParenthesizedExpressionAndArrowParameterList가 덮고 있는 ParenthesizedExpression이라고 하자.
  2. 인수 name을 사용한 exprNamedEvaluation을 ? 반환한다.
ParenthesizedExpression : ( Expression )
  1. Assert: IsAnonymousFunctionDefinition(Expression)는 true이다.
  2. 인수 name을 사용한 ExpressionNamedEvaluation을 ? 반환한다.
FunctionExpression : function ( FormalParameters ) { FunctionBody }
  1. 인수 name을 사용한 FunctionExpressionInstantiateOrdinaryFunctionExpression을 반환한다.
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
  1. 인수 name을 사용한 GeneratorExpressionInstantiateGeneratorFunctionExpression을 반환한다.
AsyncGeneratorExpression : async function * ( FormalParameters ) { AsyncGeneratorBody }
  1. 인수 name을 사용한 AsyncGeneratorExpressionInstantiateAsyncGeneratorFunctionExpression을 반환한다.
AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
  1. 인수 name을 사용한 AsyncFunctionExpressionInstantiateAsyncFunctionExpression을 반환한다.
ArrowFunction : ArrowParameters => ConciseBody
  1. 인수 name을 사용한 ArrowFunctionInstantiateArrowFunctionExpression을 반환한다.
AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
  1. 인수 name을 사용한 AsyncArrowFunctionInstantiateAsyncArrowFunctionExpression을 반환한다.
ClassExpression : class ClassTail
  1. sourceTextClassExpression일치한 소스 텍스트라고 하자.
  2. 인수 undefined, name, sourceText를 사용한 ClassTailClassDefinitionEvaluation을 ? 반환한다.

8.5 Contains

8.5.1 Static Semantics: Contains

The syntax-directed operation Contains takes argument symbol (a grammar symbol) and returns a Boolean.

이 명세에서 아래에 나열되지 않은 모든 문법 생산 대안은 암묵적으로 다음 기본 Contains 정의를 가진다.

  1. 이 Parse Node의 각 자식 노드 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를 반환한다.
    2. false를 반환한다.
  3. ClassHeritage가 존재하면,
    1. ClassHeritage Contains symboltrue이면, true를 반환한다.
  4. 인수 symbol을 사용한 ClassBodyComputedPropertyContains 결과를 반환한다.
Note 2

하위 구조에 의존하는 정적 의미론 규칙은 일반적으로 class body 내부를 들여다보지 않으며, PropertyName만 예외이다.

ClassStaticBlock : static { ClassStaticBlockBody }
  1. false를 반환한다.
Note 3

하위 구조에 의존하는 정적 의미론 규칙은 일반적으로 static 초기화 블록 내부를 들여다보지 않는다.

ArrowFunction : ArrowParameters => ConciseBody
  1. symbolNewTarget, SuperProperty, SuperCall, super, this 중 하나가 아니면, false를 반환한다.
  2. ArrowParameters Contains symboltrue이면, true를 반환한다.
  3. ConciseBody Contains symbol을 반환한다.
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
  1. formalsCoverParenthesizedExpressionAndArrowParameterList가 덮고 있는 ArrowFormalParameters라고 하자.
  2. formals Contains symbol을 반환한다.
AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody
  1. symbolNewTarget, SuperProperty, SuperCall, super, this 중 하나가 아니면, false를 반환한다.
  2. AsyncConciseBody Contains symbol을 반환한다.
AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
  1. symbolNewTarget, SuperProperty, SuperCall, super, this 중 하나가 아니면, false를 반환한다.
  2. headCoverCallExpressionAndAsyncArrowHead가 덮고 있는 AsyncArrowHead라고 하자.
  3. head Contains symboltrue이면, true를 반환한다.
  4. AsyncConciseBody Contains symbol을 반환한다.
Note 4

Contains는 ArrowFunction 또는 AsyncArrowFunction 내부에서 new.target, this, super 사용을 감지하는 데 사용된다.

PropertyDefinition : MethodDefinition
  1. symbolMethodDefinition이면, true를 반환한다.
  2. 인수 symbol을 사용한 MethodDefinitionComputedPropertyContains 결과를 반환한다.
LiteralPropertyName : IdentifierName
  1. false를 반환한다.
MemberExpression : MemberExpression . IdentifierName
  1. MemberExpression Contains symboltrue이면, true를 반환한다.
  2. false를 반환한다.
SuperProperty : super . IdentifierName
  1. symbolReservedWord 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 Static Semantics: ComputedPropertyContains

The syntax-directed operation ComputedPropertyContains takes argument symbol (a grammar symbol) and returns a 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. 인수 symbol을 사용한 ClassElementNameComputedPropertyContains 결과를 반환한다.
GeneratorMethod : * ClassElementName ( UniqueFormalParameters ) { GeneratorBody }
  1. 인수 symbol을 사용한 ClassElementNameComputedPropertyContains 결과를 반환한다.
AsyncGeneratorMethod : async * ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody }
  1. 인수 symbol을 사용한 ClassElementNameComputedPropertyContains 결과를 반환한다.
ClassElementList : ClassElementList ClassElement
  1. inList를 인수 symbol을 사용한 ClassElementListComputedPropertyContains라고 하자.
  2. inListtrue이면, true를 반환한다.
  3. 인수 symbol을 사용한 ClassElementComputedPropertyContains 결과를 반환한다.
ClassElement : ClassStaticBlock
  1. false를 반환한다.
ClassElement : ;
  1. false를 반환한다.
AsyncMethod : async ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody }
  1. 인수 symbol을 사용한 ClassElementNameComputedPropertyContains 결과를 반환한다.
FieldDefinition : ClassElementName Initializeropt
  1. 인수 symbol을 사용한 ClassElementNameComputedPropertyContains 결과를 반환한다.

8.6 기타

이 연산들은 명세 전반의 여러 위치에서 사용된다.

8.6.1 Runtime Semantics: InstantiateFunctionObject

The syntax-directed operation InstantiateFunctionObject takes arguments env (an Environment Record) and privateEnv (a PrivateEnvironment Record or null) and returns an ECMAScript function object. It is defined piecewise over the following productions:

FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } function ( FormalParameters ) { FunctionBody }
  1. 인수 envprivateEnv를 사용한 FunctionDeclarationInstantiateOrdinaryFunctionObject를 반환한다.
GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } function * ( FormalParameters ) { GeneratorBody }
  1. 인수 envprivateEnv를 사용한 GeneratorDeclarationInstantiateGeneratorFunctionObject를 반환한다.
AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } async function * ( FormalParameters ) { AsyncGeneratorBody }
  1. 인수 envprivateEnv를 사용한 AsyncGeneratorDeclarationInstantiateAsyncGeneratorFunctionObject를 반환한다.
AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } async function ( FormalParameters ) { AsyncFunctionBody }
  1. 인수 envprivateEnv를 사용한 AsyncFunctionDeclarationInstantiateAsyncFunctionObject를 반환한다.

8.6.2 Runtime Semantics: BindingInitialization

The syntax-directed operation BindingInitialization takes arguments value (an ECMAScript language value) and environment (an Environment Record or undefined) and returns either a normal completion containing unused or an abrupt completion.

Note

environmentundefined가 전달되면, 초기화 값을 할당하기 위해 PutValue 연산을 사용해야 함을 나타낸다. 이는 var 문과 일부 non-strict 함수의 형식 매개변수 목록의 경우이다 (참조 10.2.11). 이런 경우에는 lexical binding이 hoist되고, initializer 평가 전에 사전 초기화된다.

It is defined piecewise over the following productions:

BindingIdentifier : Identifier
  1. nameIdentifierStringValue라고 하자.
  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. 인수 valueenvironment를 사용한 ObjectBindingPatternBindingInitialization을 ? 반환한다.
BindingPattern : ArrayBindingPattern
  1. iteratorRecord를 ? GetIterator(value, sync)라고 하자.
  2. result를 인수 iteratorRecordenvironment를 사용한 ArrayBindingPatternIteratorBindingInitialization에 대한 Completion이라고 하자.
  3. iteratorRecord.[[Done]]false이면, ? IteratorClose(iteratorRecord, result)를 반환한다.
  4. result를 반환한다.
ObjectBindingPattern : { }
  1. unused를 반환한다.
ObjectBindingPattern : { BindingPropertyList } { BindingPropertyList , }
  1. 인수 valueenvironment를 사용한 BindingPropertyListPropertyBindingInitialization을 ? 수행한다.
  2. unused를 반환한다.
ObjectBindingPattern : { BindingRestProperty }
  1. excludedNames를 새로운 빈 List라고 하자.
  2. 인수 value, environment, excludedNames를 사용한 BindingRestPropertyRestBindingInitialization을 ? 반환한다.
ObjectBindingPattern : { BindingPropertyList , BindingRestProperty }
  1. excludedNames을 인수 valueenvironment를 사용한 BindingPropertyListPropertyBindingInitialization 결과라고 하자.
  2. 인수 value, environment, excludedNames을 사용한 BindingRestPropertyRestBindingInitialization을 ? 반환한다.

8.6.2.1 InitializeBoundName ( name, value, environment )

The abstract operation InitializeBoundName takes arguments name (a String), value (an ECMAScript language value), and environment (an Environment Record or undefined) and returns either a normal completion containing unused or an abrupt completion. It performs the following steps when called:

  1. environmentundefined가 아니면,
    1. environment.InitializeBinding(name, value)를 수행한다.
    2. unused를 반환한다.
  2. lhs를 ? ResolveBinding(name)이라고 하자.
  3. PutValue(lhs, value)를 반환한다.

8.6.3 Runtime Semantics: IteratorBindingInitialization

The syntax-directed operation IteratorBindingInitialization takes arguments iteratorRecord (an Iterator Record) and environment (an Environment Record or undefined) and returns either a normal completion containing unused or an abrupt completion.

Note

environmentundefined가 전달되면, 초기화 값을 할당하기 위해 PutValue 연산을 사용해야 함을 나타낸다. 이는 non-strict 함수의 형식 매개변수 목록의 경우이다. 이 경우에는 같은 이름의 매개변수가 여러 개 있을 가능성을 처리하기 위해 형식 매개변수 바인딩이 사전 초기화된다.

It is defined piecewise over the following productions:

ArrayBindingPattern : [ ]
  1. unused를 반환한다.
ArrayBindingPattern : [ Elision ]
  1. 인수 iteratorRecord를 사용한 ElisionIteratorDestructuringAssignmentEvaluation을 ? 반환한다.
ArrayBindingPattern : [ Elisionopt BindingRestElement ]
  1. Elision이 존재하면,
    1. 인수 iteratorRecord를 사용한 ElisionIteratorDestructuringAssignmentEvaluation을 ? 수행한다.
  2. 인수 iteratorRecordenvironment를 사용한 BindingRestElementIteratorBindingInitialization을 ? 반환한다.
ArrayBindingPattern : [ BindingElementList , Elision ]
  1. 인수 iteratorRecordenvironment를 사용한 BindingElementListIteratorBindingInitialization을 ? 수행한다.
  2. 인수 iteratorRecord를 사용한 ElisionIteratorDestructuringAssignmentEvaluation을 ? 반환한다.
ArrayBindingPattern : [ BindingElementList , Elisionopt BindingRestElement ]
  1. 인수 iteratorRecordenvironment를 사용한 BindingElementListIteratorBindingInitialization을 ? 수행한다.
  2. Elision이 존재하면,
    1. 인수 iteratorRecord를 사용한 ElisionIteratorDestructuringAssignmentEvaluation을 ? 수행한다.
  3. 인수 iteratorRecordenvironment를 사용한 BindingRestElementIteratorBindingInitialization을 ? 반환한다.
BindingElementList : BindingElementList , BindingElisionElement
  1. 인수 iteratorRecordenvironment를 사용한 BindingElementListIteratorBindingInitialization을 ? 수행한다.
  2. 인수 iteratorRecordenvironment를 사용한 BindingElisionElementIteratorBindingInitialization을 ? 반환한다.
BindingElisionElement : Elision BindingElement
  1. 인수 iteratorRecord를 사용한 ElisionIteratorDestructuringAssignmentEvaluation을 ? 수행한다.
  2. 인수 iteratorRecordenvironment를 사용한 BindingElementIteratorBindingInitialization을 ? 반환한다.
SingleNameBinding : BindingIdentifier Initializeropt
  1. bindingIdBindingIdentifierStringValue라고 하자.
  2. lhs를 ? ResolveBinding(bindingId, environment)라고 하자.
  3. vundefined라고 하자.
  4. iteratorRecord.[[Done]]false이면,
    1. next를 ? IteratorStepValue(iteratorRecord)라고 하자.
    2. nextdone이 아니면,
      1. vnext로 설정한다.
  5. Initializer가 존재하고 vundefined이면,
    1. IsAnonymousFunctionDefinition(Initializer)가 true이면,
      1. v를 인수 bindingId를 사용한 InitializerNamedEvaluation 결과로 ? 설정한다.
    2. 그렇지 않으면,
      1. defaultValueInitializerEvaluation 결과로 ? 하자.
      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. nextdone이 아니면,
      1. vnext로 설정한다.
  3. Initializer가 존재하고 vundefined이면,
    1. defaultValueInitializerEvaluation 결과로 ? 하자.
    2. v를 ? GetValue(defaultValue)로 설정한다.
  4. 인수 venvironment를 사용한 BindingPatternBindingInitialization을 ? 반환한다.
BindingRestElement : ... BindingIdentifier
  1. lhs를 ? ResolveBinding(BindingIdentifierStringValue, environment)라고 하자.
  2. array를 ! ArrayCreate(0)라고 하자.
  3. n을 0이라고 하자.
  4. 다음을 반복한다.
    1. nextdone이라고 하자.
    2. iteratorRecord.[[Done]]false이면,
      1. next를 ? IteratorStepValue(iteratorRecord)로 설정한다.
    3. nextdone이면,
      1. environmentundefined이면, ? PutValue(lhs, array)를 반환한다.
      2. InitializeReferencedBinding(lhs, array)를 반환한다.
    4. CreateDataPropertyOrThrow(array, ! ToString(𝔽(n)), next)를 수행한다.
    5. nn + 1로 설정한다.
BindingRestElement : ... BindingPattern
  1. array를 ! ArrayCreate(0)라고 하자.
  2. n을 0이라고 하자.
  3. 다음을 반복한다.
    1. nextdone이라고 하자.
    2. iteratorRecord.[[Done]]false이면,
      1. next를 ? IteratorStepValue(iteratorRecord)로 설정한다.
    3. nextdone이면,
      1. 인수 arrayenvironment를 사용한 BindingPatternBindingInitialization을 ? 반환한다.
    4. CreateDataPropertyOrThrow(array, ! ToString(𝔽(n)), next)를 수행한다.
    5. nn + 1로 설정한다.
FormalParameters : [empty]
  1. unused를 반환한다.
FormalParameters : FormalParameterList , FunctionRestParameter
  1. 인수 iteratorRecordenvironment를 사용한 FormalParameterListIteratorBindingInitialization을 ? 수행한다.
  2. 인수 iteratorRecordenvironment를 사용한 FunctionRestParameterIteratorBindingInitialization을 ? 반환한다.
FormalParameterList : FormalParameterList , FormalParameter
  1. 인수 iteratorRecordenvironment를 사용한 FormalParameterListIteratorBindingInitialization을 ? 수행한다.
  2. 인수 iteratorRecordenvironment를 사용한 FormalParameterIteratorBindingInitialization을 ? 반환한다.
ArrowParameters : BindingIdentifier
  1. vundefined라고 하자.
  2. Assert: iteratorRecord.[[Done]]false이다.
  3. next를 ? IteratorStepValue(iteratorRecord)라고 하자.
  4. nextdone이 아니면,
    1. vnext로 설정한다.
  5. 인수 venvironment를 사용한 BindingIdentifierBindingInitialization을 ? 반환한다.
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
  1. formalsCoverParenthesizedExpressionAndArrowParameterList가 덮고 있는 ArrowFormalParameters라고 하자.
  2. 인수 iteratorRecordenvironment를 사용한 formalsIteratorBindingInitialization을 ? 반환한다.
AsyncArrowBindingIdentifier : BindingIdentifier
  1. vundefined라고 하자.
  2. Assert: iteratorRecord.[[Done]]false이다.
  3. next를 ? IteratorStepValue(iteratorRecord)라고 하자.
  4. nextdone이 아니면,
    1. vnext로 설정한다.
  5. 인수 venvironment를 사용한 BindingIdentifierBindingInitialization을 ? 반환한다.

8.6.4 Static Semantics: AssignmentTargetType

The syntax-directed operation AssignmentTargetType takes no arguments and returns simple, web-compat, or invalid. It is defined piecewise over the following productions:

IdentifierReference : Identifier
  1. IsStrict(this IdentifierReference)가 true이고 IdentifierStringValue"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. exprAssignmentTargetType을 반환한다.
CallExpression : CoverCallExpressionAndAsyncArrowHead CallExpression Arguments
  1. Normative Optional
    호스트가 웹 브라우저이거나 Function Call Assignment Target에 대한 Runtime Error를 지원하고 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 Static Semantics: PropName

The syntax-directed operation PropName takes no arguments and returns a String or empty. It is defined piecewise over the following productions:

PropertyDefinition : IdentifierReference
  1. IdentifierReferenceStringValue를 반환한다.
PropertyDefinition : ... AssignmentExpression
  1. empty를 반환한다.
PropertyDefinition : PropertyName : AssignmentExpression
  1. PropertyNamePropName을 반환한다.
LiteralPropertyName : IdentifierName AttributeKey : IdentifierName
  1. IdentifierNameStringValue를 반환한다.
LiteralPropertyName : StringLiteral AttributeKey : StringLiteral
  1. StringLiteralSV를 반환한다.
LiteralPropertyName : NumericLiteral
  1. nbrNumericLiteralNumericValue라고 하자.
  2. ToString(nbr)을 반환한다.
ComputedPropertyName : [ AssignmentExpression ]
  1. empty를 반환한다.
MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody } get ClassElementName ( ) { FunctionBody } set ClassElementName ( PropertySetParameterList ) { FunctionBody }
  1. ClassElementNamePropName을 반환한다.
GeneratorMethod : * ClassElementName ( UniqueFormalParameters ) { GeneratorBody }
  1. ClassElementNamePropName을 반환한다.
AsyncGeneratorMethod : async * ClassElementName ( UniqueFormalParameters ) { AsyncGeneratorBody }
  1. ClassElementNamePropName을 반환한다.
ClassElement : ClassStaticBlock
  1. empty를 반환한다.
ClassElement : ;
  1. empty를 반환한다.
AsyncMethod : async ClassElementName ( UniqueFormalParameters ) { AsyncFunctionBody }
  1. ClassElementNamePropName을 반환한다.
FieldDefinition : ClassElementName Initializeropt
  1. ClassElementNamePropName을 반환한다.
ClassElementName : PrivateIdentifier
  1. empty를 반환한다.