ECMA-262 (12th Edition) ECMAScript 2021 Language Specification - page 17

 

  Главная      Manuals     ECMA-262 (12th Edition) ECMAScript 2021 Language Specification

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     15      16      17      18     ..

 

 

 

ECMA-262 (12th Edition) ECMAScript 2021 Language Specification - page 17

 

 

StatementListItem

 

:

 

Declaration

1.  Return a new empty 

List

.

VariableDeclarationList

 

:

 

VariableDeclaration

1.  Return a 

List

 whose sole element is 

VariableDeclaration

.

VariableDeclarationList

 

:

 

VariableDeclarationList

 

,

 

VariableDeclaration

1.  Let 

declarations

 be 

VarScopedDeclarations

 of 

VariableDeclarationList

.

2.  Append 

VariableDeclaration

 to 

declarations

.

3.  Return 

declarations

.

IfStatement

 

:

 

if

 

(

 

Expression

 

)

 

Statement

 

else

 

Statement

1.  Let 

declarations

 be 

VarScopedDeclarations

 of the first 

Statement

.

2.  Append to 

declarations

 the elements of the 

VarScopedDeclarations

 of the second 

Statement

.

3.  Return 

declarations

.

IfStatement

 

:

 

if

 

(

 

Expression

 

)

 

Statement

1.  Return the 

VarScopedDeclarations

 of 

Statement

.

DoWhileStatement

 

:

 

do

 

Statement

 

while

 

(

 

Expression

 

)

 

;

1.  Return the 

VarScopedDeclarations

 of 

Statement

.

WhileStatement

 

:

 

while

 

(

 

Expression

 

)

 

Statement

1.  Return the 

VarScopedDeclarations

 of 

Statement

.

ForStatement

 

:

 

for

 

(

 

Expression

opt

 

;

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

1.  Return the 

VarScopedDeclarations

 of 

Statement

.

ForStatement

 

:

 

for

 

(

 

var

 

VariableDeclarationList

 

;

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

1.  Let 

declarations

 be 

VarScopedDeclarations

 of 

VariableDeclarationList

.

2.  Append to 

declarations

 the elements of the 

VarScopedDeclarations

 of 

Statement

.

3.  Return 

declarations

.

ForStatement

 

:

 

for

 

(

 

LexicalDeclaration

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

1.  Return the 

VarScopedDeclarations

 of 

Statement

.

ForInOfStatement

 

:

for

 

(

 

LeftHandSideExpression

 

in

 

Expression

 

)

 

Statement

for

 

(

 

ForDeclaration

 

in

 

Expression

 

)

 

Statement

for

 

(

 

LeftHandSideExpression

 

of

 

AssignmentExpression

 

)

 

Statement

for

 

(

 

ForDeclaration

 

of

 

AssignmentExpression

 

)

 

Statement

for

 

await

 

(

 

LeftHandSideExpression

 

of

 

AssignmentExpression

 

)

 

Statement

for

 

await

 

(

 

ForDeclaration

 

of

 

AssignmentExpression

 

)

 

Statement

154

1.  Return the 

VarScopedDeclarations

 of 

Statement

.

ForInOfStatement

 

:

for

 

(

 

var

 

ForBinding

 

in

 

Expression

 

)

 

Statement

for

 

(

 

var

 

ForBinding

 

of

 

AssignmentExpression

 

)

 

Statement

for

 

await

 

(

 

var

 

ForBinding

 

of

 

AssignmentExpression

 

)

 

Statement

1.  Let 

declarations

 be a 

List

 whose sole element is 

ForBinding

.

2.  Append to 

declarations

 the elements of the 

VarScopedDeclarations

 of 

Statement

.

3.  Return 

declarations

.

NOTE

WithStatement

 

:

 

with

 

(

 

Expression

 

)

 

Statement

1.  Return the 

VarScopedDeclarations

 of 

Statement

.

SwitchStatement

 

:

 

switch

 

(

 

Expression

 

)

 

CaseBlock

1.  Return the 

VarScopedDeclarations

 of 

CaseBlock

.

CaseBlock

 

:

 

{

 

}

1.  Return a new empty 

List

.

CaseBlock

 

:

 

{

 

CaseClauses

opt

 

DefaultClause

 

CaseClauses

opt

 

}

1.  If the first 

CaseClauses

 is present, let 

declarations

 be the 

VarScopedDeclarations

 of the first 

CaseClauses

.

2.  Else, let 

declarations

 be a new empty 

List

.

3.  Append to 

declarations

 the elements of the 

VarScopedDeclarations

 of 

DefaultClause

.

4.  If the second 

CaseClauses

 is not present, return 

declarations

.

5.  Return the result of appending to 

declarations

 the elements of the 

VarScopedDeclarations

 of the second 

CaseClauses

.

CaseClauses

 

:

 

CaseClauses

 

CaseClause

1.  Let 

declarations

 be 

VarScopedDeclarations

 of 

CaseClauses

.

2.  Append to 

declarations

 the elements of the 

VarScopedDeclarations

 of 

CaseClause

.

3.  Return 

declarations

.

CaseClause

 

:

 

case

 

Expression

 

:

 

StatementList

opt

1.  If the 

StatementList

 is present, return the 

VarScopedDeclarations

 of 

StatementList

.

2.  Return a new empty 

List

.

DefaultClause

 

:

 

default

 

:

 

StatementList

opt

1.  If the 

StatementList

 is present, return the 

VarScopedDeclarations

 of 

StatementList

.

2.  Return a new empty 

List

.

LabelledStatement

 

:

 

LabelIdentifier

 

:

 

LabelledItem

This section is extended by Annex 

B.3.6

.

155

1.  Return the 

VarScopedDeclarations

 of 

LabelledItem

.

LabelledItem

 

:

 

FunctionDeclaration

1.  Return a new empty 

List

.

TryStatement

 

:

 

try

 

Block

 

Catch

1.  Let 

declarations

 be 

VarScopedDeclarations

 of 

Block

.

2.  Append to 

declarations

 the elements of the 

VarScopedDeclarations

 of 

Catch

.

3.  Return 

declarations

.

TryStatement

 

:

 

try

 

Block

 

Finally

1.  Let 

declarations

 be 

VarScopedDeclarations

 of 

Block

.

2.  Append to 

declarations

 the elements of the 

VarScopedDeclarations

 of 

Finally

.

3.  Return 

declarations

.

TryStatement

 

:

 

try

 

Block

 

Catch

 

Finally

1.  Let 

declarations

 be 

VarScopedDeclarations

 of 

Block

.

2.  Append to 

declarations

 the elements of the 

VarScopedDeclarations

 of 

Catch

.

3.  Append to 

declarations

 the elements of the 

VarScopedDeclarations

 of 

Finally

.

4.  Return 

declarations

.

Catch

 

:

 

catch

 

(

 

CatchParameter

 

)

 

Block

1.  Return the 

VarScopedDeclarations

 of 

Block

.

FunctionStatementList

 

:

  [empty]

1.  Return a new empty 

List

.

FunctionStatementList

 

:

 

StatementList

1.  Return the 

TopLevelVarScopedDeclarations

 of 

StatementList

.

ConciseBody

 

:

 

ExpressionBody

1.  Return a new empty 

List

.

AsyncConciseBody

 

:

 

ExpressionBody

1.  Return a new empty 

List

.

ScriptBody

 

:

 

StatementList

1.  Return 

TopLevelVarScopedDeclarations

 of 

StatementList

.

Module

 

:

  [empty]

1.  Return a new empty 

List

.

ModuleItemList

 

:

 

ModuleItemList

 

ModuleItem

1.  Let 

declarations

 be 

VarScopedDeclarations

 of 

ModuleItemList

.

156

2.  Append to 

declarations

 the elements of the 

VarScopedDeclarations

 of 

ModuleItem

.

3.  Return 

declarations

.

ModuleItem

 

:

 

ImportDeclaration

1.  Return a new empty 

List

.

ModuleItem

 

:

 

ExportDeclaration

1.  If 

ExportDeclaration

 is 

export

export

 

VariableStatement

, return 

VarScopedDeclarations

 of 

VariableStatement

.

2.  Return a new empty 

List

.

StatementList

 

:

 

StatementList

 

StatementListItem

1.  Let 

names

 be 

TopLevelLexicallyDeclaredNames

 of 

StatementList

.

2.  Append to 

names

 the elements of the 

TopLevelLexicallyDeclaredNames

 of 

StatementListItem

.

3.  Return 

names

.

StatementListItem

 

:

 

Statement

1.  Return a new empty 

List

.

StatementListItem

 

:

 

Declaration

1.  If 

Declaration

 is 

Declaration

 

:

 

HoistableDeclaration

 , then

a.  Return « ».

2.  Return the 

BoundNames

 of 

Declaration

.

NOTE

LabelledStatement

 

:

 

LabelIdentifier

 

:

 

LabelledItem

1.  Return a new empty 

List

.

Block

 

:

 

{

 

}

1.  Return a new empty 

List

.

StatementList

 

:

 

StatementList

 

StatementListItem

1.  Let 

declarations

 be 

TopLevelLexicallyScopedDeclarations

 of 

StatementList

.

2.  Append to 

declarations

 the elements of the 

TopLevelLexicallyScopedDeclarations

 of 

StatementListItem

.

3.  Return 

declarations

.

StatementListItem

 

:

 

Statement

1.  Return a new empty 

List

.

At the top level of a function, or script, function declarations are treated like var declarations
rather than like lexical declarations.

8.1.8  Static Semantics: TopLevelLexicallyDeclaredNames

8.1.9  Static Semantics: TopLevelLexicallyScopedDeclarations

157

StatementListItem

 

:

 

Declaration

1.  If 

Declaration

 is 

Declaration

 

:

 

HoistableDeclaration

 , then

a.  Return « ».

2.  Return a 

List

 whose sole element is 

Declaration

.

LabelledStatement

 

:

 

LabelIdentifier

 

:

 

LabelledItem

1.  Return a new empty 

List

.

Block

 

:

 

{

 

}

1.  Return a new empty 

List

.

StatementList

 

:

 

StatementList

 

StatementListItem

1.  Let 

names

 be 

TopLevelVarDeclaredNames

 of 

StatementList

.

2.  Append to 

names

 the elements of the 

TopLevelVarDeclaredNames

 of 

StatementListItem

.

3.  Return 

names

.

StatementListItem

 

:

 

Declaration

1.  If 

Declaration

 is 

Declaration

 

:

 

HoistableDeclaration

 , then

a.  Return the 

BoundNames

 of 

HoistableDeclaration

.

2.  Return a new empty 

List

.

StatementListItem

 

:

 

Statement

1.  If 

Statement

 is 

Statement

 

:

 

LabelledStatement

 , return 

TopLevelVarDeclaredNames

 of 

Statement

.

2.  Return 

VarDeclaredNames

 of 

Statement

.

NOTE

LabelledStatement

 

:

 

LabelIdentifier

 

:

 

LabelledItem

1.  Return the 

TopLevelVarDeclaredNames

 of 

LabelledItem

.

LabelledItem

 

:

 

Statement

1.  If 

Statement

 is 

Statement

 

:

 

LabelledStatement

 , return 

TopLevelVarDeclaredNames

 of 

Statement

.

2.  Return 

VarDeclaredNames

 of 

Statement

.

LabelledItem

 

:

 

FunctionDeclaration

1.  Return 

BoundNames

 of 

FunctionDeclaration

.

Block

 

:

 

{

 

}

1.  Return a new empty 

List

.

At the top level of a function or script, inner function declarations are treated like var
declarations.

8.1.10  Static Semantics: TopLevelVarDeclaredNames

8.1.11  Static Semantics: TopLevelVarScopedDeclarations

158

StatementList

 

:

 

StatementList

 

StatementListItem

1.  Let 

declarations

 be 

TopLevelVarScopedDeclarations

 of 

StatementList

.

2.  Append to 

declarations

 the elements of the 

TopLevelVarScopedDeclarations

 of 

StatementListItem

.

3.  Return 

declarations

.

StatementListItem

 

:

 

Statement

1.  If 

Statement

 is 

Statement

 

:

 

LabelledStatement

 , return 

TopLevelVarScopedDeclarations

 of 

Statement

.

2.  Return 

VarScopedDeclarations

 of 

Statement

.

StatementListItem

 

:

 

Declaration

1.  If 

Declaration

 is 

Declaration

 

:

 

HoistableDeclaration

 , then

a.  Let 

declaration

 be 

DeclarationPart

 of 

HoistableDeclaration

.

b.  Return « 

declaration

 ».

2.  Return a new empty 

List

.

LabelledStatement

 

:

 

LabelIdentifier

 

:

 

LabelledItem

1.  Return the 

TopLevelVarScopedDeclarations

 of 

LabelledItem

.

LabelledItem

 

:

 

Statement

1.  If 

Statement

 is 

Statement

 

:

 

LabelledStatement

 , return 

TopLevelVarScopedDeclarations

 of 

Statement

.

2.  Return 

VarScopedDeclarations

 of 

Statement

.

LabelledItem

 

:

 

FunctionDeclaration

1.  Return a 

List

 whose sole element is 

FunctionDeclaration

.

With parameter 

labelSet

.

Statement

 

:

VariableStatement
EmptyStatement
ExpressionStatement
ContinueStatement
BreakStatement
ReturnStatement
ThrowStatement
DebuggerStatement

Block

 

:

 

{

 

}

StatementListItem

 

:

 

Declaration

1.  Return 

false

.

8.2  Labels

8.2.1  Static Semantics: ContainsDuplicateLabels

159

StatementList

 

:

 

StatementList

 

StatementListItem

1.  Let 

hasDuplicates

 be 

ContainsDuplicateLabels

 of 

StatementList

 with argument 

labelSet

.

2.  If 

hasDuplicates

 is 

true

, return 

true

.

3.  Return 

ContainsDuplicateLabels

 of 

StatementListItem

 with argument 

labelSet

.

IfStatement

 

:

 

if

 

(

 

Expression

 

)

 

Statement

 

else

 

Statement

1.  Let 

hasDuplicate

 be 

ContainsDuplicateLabels

 of the first 

Statement

 with argument 

labelSet

.

2.  If 

hasDuplicate

 is 

true

, return 

true

.

3.  Return 

ContainsDuplicateLabels

 of the second 

Statement

 with argument 

labelSet

.

IfStatement

 

:

 

if

 

(

 

Expression

 

)

 

Statement

1.  Return 

ContainsDuplicateLabels

 of 

Statement

 with argument 

labelSet

.

DoWhileStatement

 

:

 

do

 

Statement

 

while

 

(

 

Expression

 

)

 

;

1.  Return 

ContainsDuplicateLabels

 of 

Statement

 with argument 

labelSet

.

WhileStatement

 

:

 

while

 

(

 

Expression

 

)

 

Statement

1.  Return 

ContainsDuplicateLabels

 of 

Statement

 with argument 

labelSet

.

ForStatement

 

:

for

 

(

 

Expression

opt

 

;

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

for

 

(

 

var

 

VariableDeclarationList

 

;

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

for

 

(

 

LexicalDeclaration

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

1.  Return 

ContainsDuplicateLabels

 of 

Statement

 with argument 

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.  Return 

ContainsDuplicateLabels

 of 

Statement

 with argument 

labelSet

.

NOTE

WithStatement

 

:

 

with

 

(

 

Expression

 

)

 

Statement

1.  Return 

ContainsDuplicateLabels

 of 

Statement

 with argument 

labelSet

.

SwitchStatement

 

:

 

switch

 

(

 

Expression

 

)

 

CaseBlock

This section is extended by Annex 

B.3.6

.

160

1.  Return 

ContainsDuplicateLabels

 of 

CaseBlock

 with argument 

labelSet

.

CaseBlock

 

:

 

{

 

}

1.  Return 

false

.

CaseBlock

 

:

 

{

 

CaseClauses

opt

 

DefaultClause

 

CaseClauses

opt

 

}

1.  If the first 

CaseClauses

 is present, then

a.  Let 

hasDuplicates

 be 

ContainsDuplicateLabels

 of the first 

CaseClauses

 with argument 

labelSet

.

b.  If 

hasDuplicates

 is 

true

, return 

true

.

2.  Let 

hasDuplicates

 be 

ContainsDuplicateLabels

 of 

DefaultClause

 with argument 

labelSet

.

3.  If 

hasDuplicates

 is 

true

, return 

true

.

4.  If the second 

CaseClauses

 is not present, return 

false

.

5.  Return 

ContainsDuplicateLabels

 of the second 

CaseClauses

 with argument 

labelSet

.

CaseClauses

 

:

 

CaseClauses

 

CaseClause

1.  Let 

hasDuplicates

 be 

ContainsDuplicateLabels

 of 

CaseClauses

 with argument 

labelSet

.

2.  If 

hasDuplicates

 is 

true

, return 

true

.

3.  Return 

ContainsDuplicateLabels

 of 

CaseClause

 with argument 

labelSet

.

CaseClause

 

:

 

case

 

Expression

 

:

 

StatementList

opt

1.  If the 

StatementList

 is present, return 

ContainsDuplicateLabels

 of 

StatementList

 with argument 

labelSet

.

2.  Return 

false

.

DefaultClause

 

:

 

default

 

:

 

StatementList

opt

1.  If the 

StatementList

 is present, return 

ContainsDuplicateLabels

 of 

StatementList

 with argument 

labelSet

.

2.  Return 

false

.

LabelledStatement

 

:

 

LabelIdentifier

 

:

 

LabelledItem

1.  Let 

label

 be the 

StringValue

 of 

LabelIdentifier

.

2.  If 

label

 is an element of 

labelSet

, return 

true

.

3.  Let 

newLabelSet

 be a copy of 

labelSet

 with 

label

 appended.

4.  Return 

ContainsDuplicateLabels

 of 

LabelledItem

 with argument 

newLabelSet

.

LabelledItem

 

:

 

FunctionDeclaration

1.  Return 

false

.

TryStatement

 

:

 

try

 

Block

 

Catch

1.  Let 

hasDuplicates

 be 

ContainsDuplicateLabels

 of 

Block

 with argument 

labelSet

.

2.  If 

hasDuplicates

 is 

true

, return 

true

.

3.  Return 

ContainsDuplicateLabels

 of 

Catch

 with argument 

labelSet

.

TryStatement

 

:

 

try

 

Block

 

Finally

1.  Let 

hasDuplicates

 be 

ContainsDuplicateLabels

 of 

Block

 with argument 

labelSet

.

2.  If 

hasDuplicates

 is 

true

, return 

true

.

161

3.  Return 

ContainsDuplicateLabels

 of 

Finally

 with argument 

labelSet

.

TryStatement

 

:

 

try

 

Block

 

Catch

 

Finally

1.  Let 

hasDuplicates

 be 

ContainsDuplicateLabels

 of 

Block

 with argument 

labelSet

.

2.  If 

hasDuplicates

 is 

true

, return 

true

.

3.  Let 

hasDuplicates

 be 

ContainsDuplicateLabels

 of 

Catch

 with argument 

labelSet

.

4.  If 

hasDuplicates

 is 

true

, return 

true

.

5.  Return 

ContainsDuplicateLabels

 of 

Finally

 with argument 

labelSet

.

Catch

 

:

 

catch

 

(

 

CatchParameter

 

)

 

Block

1.  Return 

ContainsDuplicateLabels

 of 

Block

 with argument 

labelSet

.

FunctionStatementList

 

:

  [empty]

1.  Return 

false

.

ModuleItemList

 

:

 

ModuleItemList

 

ModuleItem

1.  Let 

hasDuplicates

 be 

ContainsDuplicateLabels

 of 

ModuleItemList

 with argument 

labelSet

.

2.  If 

hasDuplicates

 is 

true

, return 

true

.

3.  Return 

ContainsDuplicateLabels

 of 

ModuleItem

 with argument 

labelSet

.

ModuleItem

 

:

ImportDeclaration
ExportDeclaration

1.  Return 

false

.

With parameter 

labelSet

.

Statement

 

:

VariableStatement
EmptyStatement
ExpressionStatement
ContinueStatement
ReturnStatement
ThrowStatement
DebuggerStatement

Block

 

:

 

{

 

}

StatementListItem

 

:

 

Declaration

1.  Return 

false

.

StatementList

 

:

 

StatementList

 

StatementListItem

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedBreakTarget

 of 

StatementList

 with argument 

labelSet

.

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

8.2.2  Static Semantics: ContainsUndefinedBreakTarget

162

3.  Return 

ContainsUndefinedBreakTarget

 of 

StatementListItem

 with argument 

labelSet

.

IfStatement

 

:

 

if

 

(

 

Expression

 

)

 

Statement

 

else

 

Statement

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedBreakTarget

 of the first 

Statement

 with argument 

labelSet

.

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedBreakTarget

 of the second 

Statement

 with argument 

labelSet

.

IfStatement

 

:

 

if

 

(

 

Expression

 

)

 

Statement

1.  Return 

ContainsUndefinedBreakTarget

 of 

Statement

 with argument 

labelSet

.

DoWhileStatement

 

:

 

do

 

Statement

 

while

 

(

 

Expression

 

)

 

;

1.  Return 

ContainsUndefinedBreakTarget

 of 

Statement

 with argument 

labelSet

.

WhileStatement

 

:

 

while

 

(

 

Expression

 

)

 

Statement

1.  Return 

ContainsUndefinedBreakTarget

 of 

Statement

 with argument 

labelSet

.

ForStatement

 

:

for

 

(

 

Expression

opt

 

;

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

for

 

(

 

var

 

VariableDeclarationList

 

;

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

for

 

(

 

LexicalDeclaration

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

1.  Return 

ContainsUndefinedBreakTarget

 of 

Statement

 with argument 

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.  Return 

ContainsUndefinedBreakTarget

 of 

Statement

 with argument 

labelSet

.

NOTE

BreakStatement

 

:

 

break

 

;

1.  Return 

false

.

BreakStatement

 

:

 

break

 

LabelIdentifier

 

;

1.  If the 

StringValue

 of 

LabelIdentifier

 is not an element of 

labelSet

, return 

true

.

2.  Return 

false

.

This section is extended by Annex 

B.3.6

.

163

WithStatement

 

:

 

with

 

(

 

Expression

 

)

 

Statement

1.  Return 

ContainsUndefinedBreakTarget

 of 

Statement

 with argument 

labelSet

.

SwitchStatement

 

:

 

switch

 

(

 

Expression

 

)

 

CaseBlock

1.  Return 

ContainsUndefinedBreakTarget

 of 

CaseBlock

 with argument 

labelSet

.

CaseBlock

 

:

 

{

 

}

1.  Return 

false

.

CaseBlock

 

:

 

{

 

CaseClauses

opt

 

DefaultClause

 

CaseClauses

opt

 

}

1.  If the first 

CaseClauses

 is present, then

a.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedBreakTarget

 of the first 

CaseClauses

 with argument 

labelSet

.

b.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

2.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedBreakTarget

 of 

DefaultClause

 with argument 

labelSet

.

3.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

4.  If the second 

CaseClauses

 is not present, return 

false

.

5.  Return 

ContainsUndefinedBreakTarget

 of the second 

CaseClauses

 with argument 

labelSet

.

CaseClauses

 

:

 

CaseClauses

 

CaseClause

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedBreakTarget

 of 

CaseClauses

 with argument 

labelSet

.

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedBreakTarget

 of 

CaseClause

 with argument 

labelSet

.

CaseClause

 

:

 

case

 

Expression

 

:

 

StatementList

opt

1.  If the 

StatementList

 is present, return 

ContainsUndefinedBreakTarget

 of 

StatementList

 with argument 

labelSet

.

2.  Return 

false

.

DefaultClause

 

:

 

default

 

:

 

StatementList

opt

1.  If the 

StatementList

 is present, return 

ContainsUndefinedBreakTarget

 of 

StatementList

 with argument 

labelSet

.

2.  Return 

false

.

LabelledStatement

 

:

 

LabelIdentifier

 

:

 

LabelledItem

1.  Let 

label

 be the 

StringValue

 of 

LabelIdentifier

.

2.  Let 

newLabelSet

 be a copy of 

labelSet

 with 

label

 appended.

3.  Return 

ContainsUndefinedBreakTarget

 of 

LabelledItem

 with argument 

newLabelSet

.

LabelledItem

 

:

 

FunctionDeclaration

1.  Return 

false

.

TryStatement

 

:

 

try

 

Block

 

Catch

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedBreakTarget

 of 

Block

 with argument 

labelSet

.

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedBreakTarget

 of 

Catch

 with argument 

labelSet

.

164

TryStatement

 

:

 

try

 

Block

 

Finally

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedBreakTarget

 of 

Block

 with argument 

labelSet

.

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedBreakTarget

 of 

Finally

 with argument 

labelSet

.

TryStatement

 

:

 

try

 

Block

 

Catch

 

Finally

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedBreakTarget

 of 

Block

 with argument 

labelSet

.

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedBreakTarget

 of 

Catch

 with argument 

labelSet

.

4.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

5.  Return 

ContainsUndefinedBreakTarget

 of 

Finally

 with argument 

labelSet

.

Catch

 

:

 

catch

 

(

 

CatchParameter

 

)

 

Block

1.  Return 

ContainsUndefinedBreakTarget

 of 

Block

 with argument 

labelSet

.

FunctionStatementList

 

:

  [empty]

1.  Return 

false

.

ModuleItemList

 

:

 

ModuleItemList

 

ModuleItem

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedBreakTarget

 of 

ModuleItemList

 with argument 

labelSet

.

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedBreakTarget

 of 

ModuleItem

 with argument 

labelSet

.

ModuleItem

 

:

ImportDeclaration
ExportDeclaration

1.  Return 

false

.

With parameters 

iterationSet

 and 

labelSet

.

Statement

 

:

VariableStatement
EmptyStatement
ExpressionStatement
BreakStatement
ReturnStatement
ThrowStatement
DebuggerStatement

Block

 

:

 

{

 

}

StatementListItem

 

:

 

Declaration

1.  Return 

false

.

8.2.3  Static Semantics: ContainsUndefinedContinueTarget

165

BreakableStatement

 

:

 

IterationStatement

1.  Let 

newIterationSet

 be a copy of 

iterationSet

 with all the elements of 

labelSet

 appended.

2.  Return 

ContainsUndefinedContinueTarget

 of 

IterationStatement

 with arguments 

newIterationSet

 and « ».

StatementList

 

:

 

StatementList

 

StatementListItem

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedContinueTarget

 of 

StatementList

 with arguments 

iterationSet

 and «

».

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedContinueTarget

 of 

StatementListItem

 with arguments 

iterationSet

 and « ».

IfStatement

 

:

 

if

 

(

 

Expression

 

)

 

Statement

 

else

 

Statement

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedContinueTarget

 of the first 

Statement

 with arguments 

iterationSet

and « ».

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedContinueTarget

 of the second 

Statement

 with arguments 

iterationSet

 and « ».

IfStatement

 

:

 

if

 

(

 

Expression

 

)

 

Statement

1.  Return 

ContainsUndefinedContinueTarget

 of 

Statement

 with arguments 

iterationSet

 and « ».

DoWhileStatement

 

:

 

do

 

Statement

 

while

 

(

 

Expression

 

)

 

;

1.  Return 

ContainsUndefinedContinueTarget

 of 

Statement

 with arguments 

iterationSet

 and « ».

WhileStatement

 

:

 

while

 

(

 

Expression

 

)

 

Statement

1.  Return 

ContainsUndefinedContinueTarget

 of 

Statement

 with arguments 

iterationSet

 and « ».

ForStatement

 

:

for

 

(

 

Expression

opt

 

;

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

for

 

(

 

var

 

VariableDeclarationList

 

;

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

for

 

(

 

LexicalDeclaration

 

Expression

opt

 

;

 

Expression

opt

 

)

 

Statement

1.  Return 

ContainsUndefinedContinueTarget

 of 

Statement

 with arguments 

iterationSet

 and « ».

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.  Return 

ContainsUndefinedContinueTarget

 of 

Statement

 with arguments 

iterationSet

 and « ».

166

NOTE

ContinueStatement

 

:

 

continue

 

;

1.  Return 

false

.

ContinueStatement

 

:

 

continue

 

LabelIdentifier

 

;

1.  If the 

StringValue

 of 

LabelIdentifier

 is not an element of 

iterationSet

, return 

true

.

2.  Return 

false

.

WithStatement

 

:

 

with

 

(

 

Expression

 

)

 

Statement

1.  Return 

ContainsUndefinedContinueTarget

 of 

Statement

 with arguments 

iterationSet

 and « ».

SwitchStatement

 

:

 

switch

 

(

 

Expression

 

)

 

CaseBlock

1.  Return 

ContainsUndefinedContinueTarget

 of 

CaseBlock

 with arguments 

iterationSet

 and « ».

CaseBlock

 

:

 

{

 

}

1.  Return 

false

.

CaseBlock

 

:

 

{

 

CaseClauses

opt

 

DefaultClause

 

CaseClauses

opt

 

}

1.  If the first 

CaseClauses

 is present, then

a.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedContinueTarget

 of the first 

CaseClauses

 with arguments

iterationSet

 and « ».

b.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

2.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedContinueTarget

 of 

DefaultClause

 with arguments 

iterationSet

 and «

».

3.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

4.  If the second 

CaseClauses

 is not present, return 

false

.

5.  Return 

ContainsUndefinedContinueTarget

 of the second 

CaseClauses

 with arguments 

iterationSet

 and « ».

CaseClauses

 

:

 

CaseClauses

 

CaseClause

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedContinueTarget

 of 

CaseClauses

 with arguments 

iterationSet

 and « ».

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedContinueTarget

 of 

CaseClause

 with arguments 

iterationSet

 and « ».

CaseClause

 

:

 

case

 

Expression

 

:

 

StatementList

opt

1.  If the 

StatementList

 is present, return 

ContainsUndefinedContinueTarget

 of 

StatementList

 with arguments

iterationSet

 and « ».

2.  Return 

false

.

DefaultClause

 

:

 

default

 

:

 

StatementList

opt

1.  If the 

StatementList

 is present, return 

ContainsUndefinedContinueTarget

 of 

StatementList

 with arguments

iterationSet

 and « ».

2.  Return 

false

.

This section is extended by Annex 

B.3.6

.

167

LabelledStatement

 

:

 

LabelIdentifier

 

:

 

LabelledItem

1.  Let 

label

 be the 

StringValue

 of 

LabelIdentifier

.

2.  Let 

newLabelSet

 be a copy of 

labelSet

 with 

label

 appended.

3.  Return 

ContainsUndefinedContinueTarget

 of 

LabelledItem

 with arguments 

iterationSet

 and 

newLabelSet

.

LabelledItem

 

:

 

FunctionDeclaration

1.  Return 

false

.

TryStatement

 

:

 

try

 

Block

 

Catch

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedContinueTarget

 of 

Block

 with arguments 

iterationSet

 and « ».

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedContinueTarget

 of 

Catch

 with arguments 

iterationSet

 and « ».

TryStatement

 

:

 

try

 

Block

 

Finally

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedContinueTarget

 of 

Block

 with arguments 

iterationSet

 and « ».

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedContinueTarget

 of 

Finally

 with arguments 

iterationSet

 and « ».

TryStatement

 

:

 

try

 

Block

 

Catch

 

Finally

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedContinueTarget

 of 

Block

 with arguments 

iterationSet

 and « ».

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedContinueTarget

 of 

Catch

 with arguments 

iterationSet

 and « ».

4.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

5.  Return 

ContainsUndefinedContinueTarget

 of 

Finally

 with arguments 

iterationSet

 and « ».

Catch

 

:

 

catch

 

(

 

CatchParameter

 

)

 

Block

1.  Return 

ContainsUndefinedContinueTarget

 of 

Block

 with arguments 

iterationSet

 and « ».

FunctionStatementList

 

:

  [empty]

1.  Return 

false

.

ModuleItemList

 

:

 

ModuleItemList

 

ModuleItem

1.  Let 

hasUndefinedLabels

 be 

ContainsUndefinedContinueTarget

 of 

ModuleItemList

 with arguments 

iterationSet

 and

« ».

2.  If 

hasUndefinedLabels

 is 

true

, return 

true

.

3.  Return 

ContainsUndefinedContinueTarget

 of 

ModuleItem

 with arguments 

iterationSet

 and « ».

ModuleItem

 

:

ImportDeclaration
ExportDeclaration

1.  Return 

false

.

8.3  Function Name Inference

168

PrimaryExpression

 

:

 

CoverParenthesizedExpressionAndArrowParameterList

1.  Let 

expr

 be 

CoveredParenthesizedExpression

 of 

CoverParenthesizedExpressionAndArrowParameterList

.

2.  If 

IsFunctionDefinition

 of 

expr

 is 

false

, return 

false

.

3.  Return 

HasName

 of 

expr

.

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.  Return 

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.  Return 

true

.

PrimaryExpression

 

:

 

CoverParenthesizedExpressionAndArrowParameterList

1.  Let 

expr

 be 

CoveredParenthesizedExpression

 of 

CoverParenthesizedExpressionAndArrowParameterList

.

2.  Return 

IsFunctionDefinition

 of 

expr

.

PrimaryExpression

 

:

this

IdentifierReference
Literal
ArrayLiteral
ObjectLiteral

8.3.1  Static Semantics: HasName

8.3.2  Static Semantics: IsFunctionDefinition

169

 

 

 

 

 

 

 

Content      ..     15      16      17      18     ..