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

 

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

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     16      17      18      19     ..

 

 

 

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

 

 

RelationalExpression

 

instanceof

 

ShiftExpression

RelationalExpression

 

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

false

.

AssignmentExpression

 

:

ArrowFunction
AsyncArrowFunction

FunctionExpression

 

:

function

 

BindingIdentifier

opt

 

(

 

FormalParameters

 

)

 

{

 

FunctionBody

 

}

GeneratorExpression

 

:

function

 

*

 

BindingIdentifier

opt

 

(

 

FormalParameters

 

)

 

{

 

GeneratorBody

 

}

AsyncGeneratorExpression

 

:

async

 

function

 

*

 

BindingIdentifier

opt

 

(

 

FormalParameters

 

)

 

{

 

AsyncGeneratorBody

 

}

AsyncFunctionExpression

 

:

async

 

function

 

BindingIdentifier

opt

 

(

 

FormalParameters

 

)

 

{

 

AsyncFunctionBody

 

}

ClassExpression

 

:

 

class

 

BindingIdentifier

opt

 

ClassTail

171

1.  Return 

true

.

The abstract operation IsAnonymousFunctionDefinition takes argument 

expr

 (a 

Parse Node

 for 

AssignmentExpression

or a 

Parse Node

 for 

Initializer

). It determines if its argument is a function definition that does not bind a name. It

performs the following steps when called:

1.  If 

IsFunctionDefinition

 of 

expr

 is 

false

, return 

false

.

2.  Let 

hasName

 be 

HasName

 of 

expr

.

3.  If 

hasName

 is 

true

, return 

false

.

4.  Return 

true

.

PrimaryExpression

 

:

 

IdentifierReference

1.  Return 

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

NewExpression

 

:

new

 

NewExpression

LeftHandSideExpression

 

:

CallExpression
OptionalExpression

1.  Return 

false

.

8.3.3  Static Semantics: IsAnonymousFunctionDefinition ( 

expr

 )

8.3.4  Static Semantics: IsIdentifierRef

172

With parameter 

name

.

PrimaryExpression

 

:

 

CoverParenthesizedExpressionAndArrowParameterList

1.  Let 

expr

 be 

CoveredParenthesizedExpression

 of 

CoverParenthesizedExpressionAndArrowParameterList

.

2.  Return the result of performing 

NamedEvaluation

 for 

expr

 with argument 

name

.

ParenthesizedExpression

 

:

 

(

 

Expression

 

)

1. 

Assert

IsAnonymousFunctionDefinition

(

Expression

) is 

true

.

2.  Return the result of performing 

NamedEvaluation

 for 

Expression

 with argument 

name

.

FunctionExpression

 

:

 

function

 

(

 

FormalParameters

 

)

 

{

 

FunctionBody

 

}

1.  Return 

InstantiateOrdinaryFunctionExpression

 of 

FunctionExpression

 with argument 

name

.

GeneratorExpression

 

:

 

function

 

*

 

(

 

FormalParameters

 

)

 

{

 

GeneratorBody

 

}

1.  Return 

InstantiateGeneratorFunctionExpression

 of 

GeneratorExpression

 with argument 

name

.

AsyncGeneratorExpression

 

:

 

async

 

function

 

*

 

(

 

FormalParameters

 

)

 

{

 

AsyncGeneratorBody

 

}

1.  Return 

InstantiateAsyncGeneratorFunctionExpression

 of 

AsyncGeneratorExpression

 with argument 

name

.

AsyncFunctionExpression

 

:

 

async

 

function

 

(

 

FormalParameters

 

)

 

{

 

AsyncFunctionBody

 

}

1.  Return 

InstantiateAsyncFunctionExpression

 of 

AsyncFunctionExpression

 with argument 

name

.

ArrowFunction

 

:

 

ArrowParameters

 

=>

 

ConciseBody

1.  Return 

InstantiateArrowFunctionExpression

 of 

ArrowFunction

 with argument 

name

.

AsyncArrowFunction

 

:

async

 

AsyncArrowBindingIdentifier

 

=>

 

AsyncConciseBody

CoverCallExpressionAndAsyncArrowHead

 

=>

 

AsyncConciseBody

1.  Return 

InstantiateAsyncArrowFunctionExpression

 of 

AsyncArrowFunction

 with argument 

name

.

ClassExpression

 

:

 

class

 

ClassTail

1.  Let 

value

 be the result of 

ClassDefinitionEvaluation

 of 

ClassTail

 with arguments 

undefined

 and 

name

.

2. 

ReturnIfAbrupt

(

value

).

3.  Set 

value

.[[SourceText]] to the source text matched by 

ClassExpression

.

4.  Return 

value

.

With parameter 

symbol

.

8.3.5  Runtime Semantics: NamedEvaluation

8.4  Contains

8.4.1  Static Semantics: Contains

173

Every grammar production alternative in this specification which is not listed below implicitly has the following
default definition of Contains:

1.  For each child node 

child

 of this 

Parse Node

, do

a.  If 

child

 is an instance of 

symbol

, return 

true

.

b.  If 

child

 is an instance of a nonterminal, then

i.  Let 

contained

 be the result of 

child

 

Contains

 

symbol

.

ii.  If 

contained

 is 

true

, return 

true

.

2.  Return 

false

.

FunctionDeclaration

 

:

function

 

BindingIdentifier

 

(

 

FormalParameters

 

)

 

{

 

FunctionBody

 

}

function

 

(

 

FormalParameters

 

)

 

{

 

FunctionBody

 

}

FunctionExpression

 

:

function

 

BindingIdentifier

opt

 

(

 

FormalParameters

 

)

 

{

 

FunctionBody

 

}

GeneratorDeclaration

 

:

function

 

*

 

BindingIdentifier

 

(

 

FormalParameters

 

)

 

{

 

GeneratorBody

 

}

function

 

*

 

(

 

FormalParameters

 

)

 

{

 

GeneratorBody

 

}

GeneratorExpression

 

:

function

 

*

 

BindingIdentifier

opt

 

(

 

FormalParameters

 

)

 

{

 

GeneratorBody

 

}

AsyncGeneratorDeclaration

 

:

async

 

function

 

*

 

BindingIdentifier

 

(

 

FormalParameters

 

)

 

{

 

AsyncGeneratorBody

 

}

async

 

function

 

*

 

(

 

FormalParameters

 

)

 

{

 

AsyncGeneratorBody

 

}

AsyncGeneratorExpression

 

:

async

 

function

 

*

 

BindingIdentifier

opt

 

(

 

FormalParameters

 

)

 

{

 

AsyncGeneratorBody

 

}

AsyncFunctionDeclaration

 

:

async

 

function

 

BindingIdentifier

 

(

 

FormalParameters

 

)

 

{

 

AsyncFunctionBody

 

}

async

 

function

 

(

 

FormalParameters

 

)

 

{

 

AsyncFunctionBody

 

}

AsyncFunctionExpression

 

:

async

 

function

 

BindingIdentifier

opt

 

(

 

FormalParameters

 

)

 

{

 

AsyncFunctionBody

 

}

1.  Return 

false

.

NOTE 1

ClassTail

 

:

 

ClassHeritage

opt

 

{

 

ClassBody

 

}

1.  If 

symbol

 is 

ClassBody

, return 

true

.

2.  If 

symbol

 is 

ClassHeritage

, then

a.  If 

ClassHeritage

 is present, return 

true

; otherwise return 

false

.

3.  Let 

inHeritage

 be 

ClassHeritage

 

Contains

 

symbol

.

4.  If 

inHeritage

 is 

true

, return 

true

.

5.  Return the result of 

ComputedPropertyContains

 for 

ClassBody

 with argument 

symbol

.

Static semantic rules that depend upon substructure generally do not look into function
definitions.

174

NOTE 2

ArrowFunction

 

:

 

ArrowParameters

 

=>

 

ConciseBody

1.  If 

symbol

 is not one of 

NewTarget

SuperProperty

SuperCall

super

super

 or 

this

this

, return 

false

.

2.  If 

ArrowParameters

 

Contains

 

symbol

 is 

true

, return 

true

.

3.  Return 

ConciseBody

 

Contains

 

symbol

.

ArrowParameters

 

:

 

CoverParenthesizedExpressionAndArrowParameterList

1.  Let 

formals

 be 

CoveredFormalsList

 of 

CoverParenthesizedExpressionAndArrowParameterList

.

2.  Return 

formals

 

Contains

 

symbol

.

AsyncArrowFunction

 

:

 

async

 

AsyncArrowBindingIdentifier

 

=>

 

AsyncConciseBody

1.  If 

symbol

 is not one of 

NewTarget

SuperProperty

SuperCall

super

super

, or 

this

this

, return 

false

.

2.  Return 

AsyncConciseBody

 

Contains

 

symbol

.

AsyncArrowFunction

 

:

 

CoverCallExpressionAndAsyncArrowHead

 

=>

 

AsyncConciseBody

1.  If 

symbol

 is not one of 

NewTarget

SuperProperty

SuperCall

super

super

, or 

this

this

, return 

false

.

2.  Let 

head

 be 

CoveredAsyncArrowHead

 of 

CoverCallExpressionAndAsyncArrowHead

.

3.  If 

head

 

Contains

 

symbol

 is 

true

, return 

true

.

4.  Return 

AsyncConciseBody

 

Contains

 

symbol

.

NOTE 3

PropertyDefinition

 

:

 

MethodDefinition

1.  If 

symbol

 is 

MethodDefinition

, return 

true

.

2.  Return the result of 

ComputedPropertyContains

 for 

MethodDefinition

 with argument 

symbol

.

LiteralPropertyName

 

:

 

IdentifierName

1.  Return 

false

.

MemberExpression

 

:

 

MemberExpression

 

.

 

IdentifierName

1.  If 

MemberExpression

 

Contains

 

symbol

 is 

true

, return 

true

.

2.  Return 

false

.

SuperProperty

 

:

 

super

 

.

 

IdentifierName

1.  If 

symbol

 is the 

ReservedWord

 

super

super

, return 

true

.

2.  Return 

false

.

CallExpression

 

:

 

CallExpression

 

.

 

IdentifierName

1.  If 

CallExpression

 

Contains

 

symbol

 is 

true

, return 

true

.

2.  Return 

false

.

Static semantic rules that depend upon substructure generally do not look into class bodies
except for 

PropertyName

s.

Contains is used to detect 

new.target

new.target

this

this

, and 

super

super

 usage within an 

ArrowFunction

 or 

AsyncArrowFunction

.

175

OptionalChain

 

:

 

?.

 

IdentifierName

1.  Return 

false

.

OptionalChain

 

:

 

OptionalChain

 

.

 

IdentifierName

1.  If 

OptionalChain

 

Contains

 

symbol

 is 

true

, return 

true

.

2.  Return 

false

.

With parameter 

symbol

.

PropertyName

 

:

 

LiteralPropertyName

1.  Return 

false

.

PropertyName

 

:

 

ComputedPropertyName

1.  Return the result of 

ComputedPropertyName

 

Contains

 

symbol

.

MethodDefinition

 

:

PropertyName

 

(

 

UniqueFormalParameters

 

)

 

{

 

FunctionBody

 

}

get

 

PropertyName

 

(

 

)

 

{

 

FunctionBody

 

}

set

 

PropertyName

 

(

 

PropertySetParameterList

 

)

 

{

 

FunctionBody

 

}

1.  Return the result of 

ComputedPropertyContains

 for 

PropertyName

 with argument 

symbol

.

GeneratorMethod

 

:

 

*

 

PropertyName

 

(

 

UniqueFormalParameters

 

)

 

{

 

GeneratorBody

 

}

1.  Return the result of 

ComputedPropertyContains

 for 

PropertyName

 with argument 

symbol

.

AsyncGeneratorMethod

 

:

 

async

 

*

 

PropertyName

 

(

 

UniqueFormalParameters

 

)

 

{

 

AsyncGeneratorBody

 

}

1.  Return the result of 

ComputedPropertyContains

 for 

PropertyName

 with argument 

symbol

.

ClassElementList

 

:

 

ClassElementList

 

ClassElement

1.  Let 

inList

 be 

ComputedPropertyContains

 of 

ClassElementList

 with argument 

symbol

.

2.  If 

inList

 is 

true

, return 

true

.

3.  Return the result of 

ComputedPropertyContains

 for 

ClassElement

 with argument 

symbol

.

ClassElement

 

:

 

;

1.  Return 

false

.

AsyncMethod

 

:

 

async

 

PropertyName

 

(

 

UniqueFormalParameters

 

)

 

{

 

AsyncFunctionBody

 

}

1.  Return the result of 

ComputedPropertyContains

 for 

PropertyName

 with argument 

symbol

.

These operations are used in multiple places throughout the specification.

8.4.2  Static Semantics: ComputedPropertyContains

8.5  Miscellaneous

176

With parameter 

scope

.

FunctionDeclaration

 

:

function

 

BindingIdentifier

 

(

 

FormalParameters

 

)

 

{

 

FunctionBody

 

}

function

 

(

 

FormalParameters

 

)

 

{

 

FunctionBody

 

}

1.  Return ? 

InstantiateOrdinaryFunctionObject

 of 

FunctionDeclaration

 with argument 

scope

.

GeneratorDeclaration

 

:

function

 

*

 

BindingIdentifier

 

(

 

FormalParameters

 

)

 

{

 

GeneratorBody

 

}

function

 

*

 

(

 

FormalParameters

 

)

 

{

 

GeneratorBody

 

}

1.  Return ? 

InstantiateGeneratorFunctionObject

 of 

GeneratorDeclaration

 with argument 

scope

.

AsyncGeneratorDeclaration

 

:

async

 

function

 

*

 

BindingIdentifier

 

(

 

FormalParameters

 

)

 

{

 

AsyncGeneratorBody

 

}

async

 

function

 

*

 

(

 

FormalParameters

 

)

 

{

 

AsyncGeneratorBody

 

}

1.  Return ? 

InstantiateAsyncGeneratorFunctionObject

 of 

AsyncGeneratorDeclaration

 with argument 

scope

.

AsyncFunctionDeclaration

 

:

async

 

function

 

BindingIdentifier

 

(

 

FormalParameters

 

)

 

{

 

AsyncFunctionBody

 

}

async

 

function

 

(

 

FormalParameters

 

)

 

{

 

AsyncFunctionBody

 

}

1.  Return ? 

InstantiateAsyncFunctionObject

 of 

AsyncFunctionDeclaration

 with argument 

scope

.

With parameters 

value

 and 

environment

.

NOTE

BindingIdentifier

 

:

 

Identifier

1.  Let 

name

 be 

StringValue

 of 

Identifier

.

2.  Return ? 

InitializeBoundName

(

name

value

environment

).

BindingIdentifier

 

:

 

yield

1.  Return ? 

InitializeBoundName

(

"yield"

value

environment

).

BindingIdentifier

 

:

 

await

1.  Return ? 

InitializeBoundName

(

"await"

value

environment

).

BindingPattern

 

:

 

ObjectBindingPattern

undefined

 is passed for 

environment

 to indicate that a 

PutValue

 operation should be used to

assign the initialization value. This is the case for 

var

var

 statements and formal parameter lists of

some non-strict functions (See 

10.2.10

). In those cases a lexical binding is hoisted and

preinitialized prior to evaluation of its initializer.

8.5.1  Runtime Semantics: InstantiateFunctionObject

8.5.2  Runtime Semantics: BindingInitialization

177

1.  Perform ? 

RequireObjectCoercible

(

value

).

2.  Return the result of performing 

BindingInitialization

 for 

ObjectBindingPattern

 using 

value

 and 

environment

 as

arguments.

BindingPattern

 

:

 

ArrayBindingPattern

1.  Let 

iteratorRecord

 be ? 

GetIterator

(

value

).

2.  Let 

result

 be 

IteratorBindingInitialization

 of 

ArrayBindingPattern

 with arguments 

iteratorRecord

 and 

environment

.

3.  If 

iteratorRecord

.[[Done]] is 

false

, return ? 

IteratorClose

(

iteratorRecord

result

).

4.  Return 

result

.

ObjectBindingPattern

 

:

 

{

 

}

1.  Return 

NormalCompletion

(

empty

).

ObjectBindingPattern

 

:

{

 

BindingPropertyList

 

}

{

 

BindingPropertyList

 

,

 

}

1.  Perform ? 

PropertyBindingInitialization

 for 

BindingPropertyList

 using 

value

 and 

environment

 as the arguments.

2.  Return 

NormalCompletion

(

empty

).

ObjectBindingPattern

 

:

 

{

 

BindingRestProperty

 

}

1.  Let 

excludedNames

 be a new empty 

List

.

2.  Return the result of performing 

RestBindingInitialization

 of 

BindingRestProperty

 with 

value

environment

, and

excludedNames

 as the arguments.

ObjectBindingPattern

 

:

 

{

 

BindingPropertyList

 

,

 

BindingRestProperty

 

}

1.  Let 

excludedNames

 be ? 

PropertyBindingInitialization

 of 

BindingPropertyList

 with arguments 

value

 and

environment

.

2.  Return the result of performing 

RestBindingInitialization

 of 

BindingRestProperty

 with arguments 

value

,

environment

, and 

excludedNames

.

The abstract operation InitializeBoundName takes arguments 

name

value

, and 

environment

. It performs the following

steps when called:

1. 

Assert

Type

(

name

) is String.

2.  If 

environment

 is not 

undefined

, then

a.  Perform 

environment

.InitializeBinding(

name

value

).

b.  Return 

NormalCompletion

(

undefined

).

3.  Else,

a.  Let 

lhs

 be 

ResolveBinding

(

name

).

b.  Return ? 

PutValue

(

lhs

value

).

With parameters 

iteratorRecord

 and 

environment

.

8.5.2.1  InitializeBoundName ( 

name

value

environment

 )

8.5.3  Runtime Semantics: IteratorBindingInitialization

178

NOTE

ArrayBindingPattern

 

:

 

[

 

]

1.  Return 

NormalCompletion

(

empty

).

ArrayBindingPattern

 

:

 

[

 

Elision

 

]

1.  Return the result of performing 

IteratorDestructuringAssignmentEvaluation

 of 

Elision

 with 

iteratorRecord

 as the

argument.

ArrayBindingPattern

 

:

 

[

 

Elision

opt

 

BindingRestElement

 

]

1.  If 

Elision

 is present, then

a.  Perform ? 

IteratorDestructuringAssignmentEvaluation

 of 

Elision

 with 

iteratorRecord

 as the argument.

2.  Return the result of performing 

IteratorBindingInitialization

 for 

BindingRestElement

 with 

iteratorRecord

 and

environment

 as arguments.

ArrayBindingPattern

 

:

 

[

 

BindingElementList

 

,

 

Elision

 

]

1.  Perform ? 

IteratorBindingInitialization

 for 

BindingElementList

 with 

iteratorRecord

 and 

environment

 as arguments.

2.  Return the result of performing 

IteratorDestructuringAssignmentEvaluation

 of 

Elision

 with 

iteratorRecord

 as the

argument.

ArrayBindingPattern

 

:

 

[

 

BindingElementList

 

,

 

Elision

opt

 

BindingRestElement

 

]

1.  Perform ? 

IteratorBindingInitialization

 for 

BindingElementList

 with 

iteratorRecord

 and 

environment

 as arguments.

2.  If 

Elision

 is present, then

a.  Perform ? 

IteratorDestructuringAssignmentEvaluation

 of 

Elision

 with 

iteratorRecord

 as the argument.

3.  Return the result of performing 

IteratorBindingInitialization

 for 

BindingRestElement

 with 

iteratorRecord

 and

environment

 as arguments.

BindingElementList

 

:

 

BindingElementList

 

,

 

BindingElisionElement

1.  Perform ? 

IteratorBindingInitialization

 for 

BindingElementList

 with 

iteratorRecord

 and 

environment

 as arguments.

2.  Return the result of performing 

IteratorBindingInitialization

 for 

BindingElisionElement

 using 

iteratorRecord

 and

environment

 as arguments.

BindingElisionElement

 

:

 

Elision

 

BindingElement

1.  Perform ? 

IteratorDestructuringAssignmentEvaluation

 of 

Elision

 with 

iteratorRecord

 as the argument.

2.  Return the result of performing 

IteratorBindingInitialization

 of 

BindingElement

 with 

iteratorRecord

 and

environment

 as the arguments.

SingleNameBinding

 

:

 

BindingIdentifier

 

Initializer

opt

1.  Let 

bindingId

 be 

StringValue

 of 

BindingIdentifier

.

2.  Let 

lhs

 be ? 

ResolveBinding

(

bindingId

environment

).

3.  If 

iteratorRecord

.[[Done]] is 

false

, then

When 

undefined

 is passed for 

environment

 it indicates that a 

PutValue

 operation should be used

to assign the initialization value. This is the case for formal parameter lists of non-strict functions.
In that case the formal parameter bindings are preinitialized in order to deal with the possibility
of multiple parameters with the same name.

179

a.  Let 

next

 be 

IteratorStep

(

iteratorRecord

).

b.  If 

next

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

c. 

ReturnIfAbrupt

(

next

).

d.  If 

next

 is 

false

, set 

iteratorRecord

.[[Done]] to 

true

.

e.  Else,

i.  Let 

v

 be 

IteratorValue

(

next

).

ii.  If 

v

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

iii. 

ReturnIfAbrupt

(

v

).

4.  If 

iteratorRecord

.[[Done]] is 

true

, let 

v

 be 

undefined

.

5.  If 

Initializer

 is present and 

v

 is 

undefined

, then

a.  If 

IsAnonymousFunctionDefinition

(

Initializer

) is 

true

, then

i.  Set 

v

 to the result of performing 

NamedEvaluation

 for 

Initializer

 with argument 

bindingId

.

b.  Else,

i.  Let 

defaultValue

 be the result of evaluating 

Initializer

.

ii.  Set 

v

 to ? 

GetValue

(

defaultValue

).

6.  If 

environment

 is 

undefined

, return ? 

PutValue

(

lhs

v

).

7.  Return 

InitializeReferencedBinding

(

lhs

v

).

BindingElement

 

:

 

BindingPattern

 

Initializer

opt

1.  If 

iteratorRecord

.[[Done]] is 

false

, then

a.  Let 

next

 be 

IteratorStep

(

iteratorRecord

).

b.  If 

next

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

c. 

ReturnIfAbrupt

(

next

).

d.  If 

next

 is 

false

, set 

iteratorRecord

.[[Done]] to 

true

.

e.  Else,

i.  Let 

v

 be 

IteratorValue

(

next

).

ii.  If 

v

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

iii. 

ReturnIfAbrupt

(

v

).

2.  If 

iteratorRecord

.[[Done]] is 

true

, let 

v

 be 

undefined

.

3.  If 

Initializer

 is present and 

v

 is 

undefined

, then

a.  Let 

defaultValue

 be the result of evaluating 

Initializer

.

b.  Set 

v

 to ? 

GetValue

(

defaultValue

).

4.  Return the result of performing 

BindingInitialization

 of 

BindingPattern

 with 

v

 and 

environment

 as the

arguments.

BindingRestElement

 

:

 

...

 

BindingIdentifier

1.  Let 

lhs

 be ? 

ResolveBinding

(

StringValue

 of 

BindingIdentifier

environment

).

2.  Let 

A

 be ! 

ArrayCreate

(0).

3.  Let 

n

 be 0.

4.  Repeat,

a.  If 

iteratorRecord

.[[Done]] is 

false

, then

i.  Let 

next

 be 

IteratorStep

(

iteratorRecord

).

ii.  If 

next

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

iii. 

ReturnIfAbrupt

(

next

).

iv.  If 

next

 is 

false

, set 

iteratorRecord

.[[Done]] to 

true

.

b.  If 

iteratorRecord

.[[Done]] is 

true

, then

i.  If 

environment

 is 

undefined

, return ? 

PutValue

(

lhs

A

).

180

ii.  Return 

InitializeReferencedBinding

(

lhs

A

).

c.  Let 

nextValue

 be 

IteratorValue

(

next

).

d.  If 

nextValue

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

e. 

ReturnIfAbrupt

(

nextValue

).

f.  Perform ! 

CreateDataPropertyOrThrow

(

A

, ! 

ToString

(

n

)), 

nextValue

).

g.  Set 

n

 to 

n

 + 1.

BindingRestElement

 

:

 

...

 

BindingPattern

1.  Let 

A

 be ! 

ArrayCreate

(0).

2.  Let 

n

 be 0.

3.  Repeat,

a.  If 

iteratorRecord

.[[Done]] is 

false

, then

i.  Let 

next

 be 

IteratorStep

(

iteratorRecord

).

ii.  If 

next

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

iii. 

ReturnIfAbrupt

(

next

).

iv.  If 

next

 is 

false

, set 

iteratorRecord

.[[Done]] to 

true

.

b.  If 

iteratorRecord

.[[Done]] is 

true

, then

i.  Return the result of performing 

BindingInitialization

 of 

BindingPattern

 with 

A

 and 

environment

 as

the arguments.

c.  Let 

nextValue

 be 

IteratorValue

(

next

).

d.  If 

nextValue

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

e. 

ReturnIfAbrupt

(

nextValue

).

f.  Perform ! 

CreateDataPropertyOrThrow

(

A

, ! 

ToString

(

n

)), 

nextValue

).

g.  Set 

n

 to 

n

 + 1.

FormalParameters

 

:

  [empty]

1.  Return 

NormalCompletion

(

empty

).

FormalParameters

 

:

 

FormalParameterList

 

,

 

FunctionRestParameter

1.  Perform ? 

IteratorBindingInitialization

 for 

FormalParameterList

 using 

iteratorRecord

 and 

environment

 as the

arguments.

2.  Return the result of performing 

IteratorBindingInitialization

 for 

FunctionRestParameter

 using 

iteratorRecord

 and

environment

 as the arguments.

FormalParameterList

 

:

 

FormalParameterList

 

,

 

FormalParameter

1.  Perform ? 

IteratorBindingInitialization

 for 

FormalParameterList

 using 

iteratorRecord

 and 

environment

 as the

arguments.

2.  Return the result of performing 

IteratorBindingInitialization

 for 

FormalParameter

 using 

iteratorRecord

 and

environment

 as the arguments.

ArrowParameters

 

:

 

BindingIdentifier

1. 

Assert

iteratorRecord

.[[Done]] is 

false

.

2.  Let 

next

 be 

IteratorStep

(

iteratorRecord

).

3.  If 

next

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

4. 

ReturnIfAbrupt

(

next

).

5.  If 

next

 is 

false

, set 

iteratorRecord

.[[Done]] to 

true

.

181

6.  Else,

a.  Let 

v

 be 

IteratorValue

(

next

).

b.  If 

v

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

c. 

ReturnIfAbrupt

(

v

).

7.  If 

iteratorRecord

.[[Done]] is 

true

, let 

v

 be 

undefined

.

8.  Return the result of performing 

BindingInitialization

 for 

BindingIdentifier

 using 

v

 and 

environment

 as the

arguments.

ArrowParameters

 

:

 

CoverParenthesizedExpressionAndArrowParameterList

1.  Let 

formals

 be 

CoveredFormalsList

 of 

CoverParenthesizedExpressionAndArrowParameterList

.

2.  Return 

IteratorBindingInitialization

 of 

formals

 with arguments 

iteratorRecord

 and 

environment

.

AsyncArrowBindingIdentifier

 

:

 

BindingIdentifier

1. 

Assert

iteratorRecord

.[[Done]] is 

false

.

2.  Let 

next

 be 

IteratorStep

(

iteratorRecord

).

3.  If 

next

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

4. 

ReturnIfAbrupt

(

next

).

5.  If 

next

 is 

false

, set 

iteratorRecord

.[[Done]] to 

true

.

6.  Else,

a.  Let 

v

 be 

IteratorValue

(

next

).

b.  If 

v

 is an 

abrupt completion

, set 

iteratorRecord

.[[Done]] to 

true

.

c. 

ReturnIfAbrupt

(

v

).

7.  If 

iteratorRecord

.[[Done]] is 

true

, let 

v

 be 

undefined

.

8.  Return the result of performing 

BindingInitialization

 for 

BindingIdentifier

 using 

v

 and 

environment

 as the

arguments.

IdentifierReference

 

:

 

Identifier

1.  If this 

IdentifierReference

 is contained in 

strict mode code

 and 

StringValue

 of 

Identifier

 is 

"eval"

 or 

"arguments"

,

return 

invalid

.

2.  Return 

simple

.

IdentifierReference

 

:

yield

await

CallExpression

 

:

CallExpression

 

[

 

Expression

 

]

CallExpression

 

.

 

IdentifierName

MemberExpression

 

:

MemberExpression

 

[

 

Expression

 

]

MemberExpression

 

.

 

IdentifierName

SuperProperty

1.  Return 

simple

.

PrimaryExpression

 

:

8.5.4  Static Semantics: AssignmentTargetType

182

~

 

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

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

184

LeftHandSideExpression

 

AssignmentOperator

 

AssignmentExpression

LeftHandSideExpression

 

&&=

 

AssignmentExpression

LeftHandSideExpression

 

||=

 

AssignmentExpression

LeftHandSideExpression

 

??=

 

AssignmentExpression

Expression

 

:

Expression

 

,

 

AssignmentExpression

1.  Return 

invalid

.

PropertyDefinition

 

:

 

IdentifierReference

1.  Return 

StringValue

 of 

IdentifierReference

.

PropertyDefinition

 

:

 

...

 

AssignmentExpression

1.  Return 

empty

.

PropertyDefinition

 

:

 

PropertyName

 

:

 

AssignmentExpression

1.  Return 

PropName

 of 

PropertyName

.

LiteralPropertyName

 

:

 

IdentifierName

1.  Return 

StringValue

 of 

IdentifierName

.

LiteralPropertyName

 

:

 

StringLiteral

1.  Return the 

SV

 of 

StringLiteral

.

LiteralPropertyName

 

:

 

NumericLiteral

1.  Let 

nbr

 be the 

NumericValue

 of 

NumericLiteral

.

2.  Return ! 

ToString

(

nbr

).

ComputedPropertyName

 

:

 

[

 

AssignmentExpression

 

]

1.  Return 

empty

.

MethodDefinition

 

:

PropertyName

 

(

 

UniqueFormalParameters

 

)

 

{

 

FunctionBody

 

}

get

 

PropertyName

 

(

 

)

 

{

 

FunctionBody

 

}

set

 

PropertyName

 

(

 

PropertySetParameterList

 

)

 

{

 

FunctionBody

 

}

1.  Return 

PropName

 of 

PropertyName

.

GeneratorMethod

 

:

 

*

 

PropertyName

 

(

 

UniqueFormalParameters

 

)

 

{

 

GeneratorBody

 

}

1.  Return 

PropName

 of 

PropertyName

.

AsyncGeneratorMethod

 

:

 

async

 

*

 

PropertyName

 

(

 

UniqueFormalParameters

 

)

 

{

 

AsyncGeneratorBody

 

}

1.  Return 

PropName

 of 

PropertyName

.

8.5.5  Static Semantics: PropName

185

 

 

 

 

 

 

 

Content      ..     16      17      18      19     ..