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

 

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

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..      1       2         ..

 

 

 

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

 

 

6.1.6.1.9 Number::leftShift ( 

x

y

 )

6.1.6.1.10 Number::signedRightShift ( 

x

y

 )

6.1.6.1.11 Number::unsignedRightShift ( 

x

y

 )

6.1.6.1.12 Number::lessThan ( 

x

y

 )

6.1.6.1.13 Number::equal ( 

x

y

 )

6.1.6.1.14 Number::sameValue ( 

x

y

 )

6.1.6.1.15 Number::sameValueZero ( 

x

y

 )

6.1.6.1.16 NumberBitwiseOp ( 

op

x

y

 )

6.1.6.1.17 Number::bitwiseAND ( 

x

y

 )

6.1.6.1.18 Number::bitwiseXOR ( 

x

y

 )

6.1.6.1.19 Number::bitwiseOR ( 

x

y

 )

6.1.6.1.20 Number::toString ( 

x

 )

6.1.6.2 The BigInt Type

6.1.6.2.1 BigInt::unaryMinus ( 

x

 )

6.1.6.2.2 BigInt::bitwiseNOT ( 

x

 )

6.1.6.2.3 BigInt::exponentiate ( 

base

exponent

 )

6.1.6.2.4 BigInt::multiply ( 

x

y

 )

6.1.6.2.5 BigInt::divide ( 

x

y

 )

6.1.6.2.6 BigInt::remainder ( 

n

d

 )

6.1.6.2.7 BigInt::add ( 

x

y

 )

6.1.6.2.8 BigInt::subtract ( 

x

y

 )

6.1.6.2.9 BigInt::leftShift ( 

x

y

 )

6.1.6.2.10 BigInt::signedRightShift ( 

x

y

 )

6.1.6.2.11 BigInt::unsignedRightShift ( 

x

y

 )

6.1.6.2.12 BigInt::lessThan ( 

x

y

 )

6.1.6.2.13 BigInt::equal ( 

x

y

 )

6.1.6.2.14 BigInt::sameValue ( 

x

y

 )

6.1.6.2.15 BigInt::sameValueZero ( 

x

y

 )

6.1.6.2.16 BinaryAnd ( 

x

y

 )

6.1.6.2.17 BinaryOr ( 

x

y

 )

6.1.6.2.18 BinaryXor ( 

x

y

 )

6.1.6.2.19 BigIntBitwiseOp ( 

op

x

y

 )

6.1.6.2.20 BigInt::bitwiseAND ( 

x

y

 )

6.1.6.2.21 BigInt::bitwiseXOR ( 

x

y

 )

6.1.6.2.22 BigInt::bitwiseOR ( 

x

y

 )

6.1.6.2.23 BigInt::toString ( 

x

 )

6.1.7 The Object Type

6.1.7.1 Property Attributes
6.1.7.2 Object Internal Methods and Internal Slots
6.1.7.3 Invariants of the Essential Internal Methods
6.1.7.4 Well-Known Intrinsic Objects

6.2 ECMAScript Specification Types

6.2.1 The List and Record Specification Types
6.2.2 The Set and Relation Specification Types
6.2.3 The Completion Record Specification Type

6.2.3.1 Await

6.2.3.1.1 Await Fulfilled Functions
6.2.3.1.2 Await Rejected Functions

4

6.2.3.2 NormalCompletion
6.2.3.3 ThrowCompletion
6.2.3.4 UpdateEmpty ( 

completionRecord

value

 )

6.2.4 The Reference Record Specification Type

6.2.4.1 IsPropertyReference ( 

V

 )

6.2.4.2 IsUnresolvableReference ( 

V

 )

6.2.4.3 IsSuperReference ( 

V

 )

6.2.4.4 GetValue ( 

V

 )

6.2.4.5 PutValue ( 

V

W

 )

6.2.4.6 GetThisValue ( 

V

 )

6.2.4.7 InitializeReferencedBinding ( 

V

W

 )

6.2.5 The Property Descriptor Specification Type

6.2.5.1 IsAccessorDescriptor ( 

Desc

 )

6.2.5.2 IsDataDescriptor ( 

Desc

 )

6.2.5.3 IsGenericDescriptor ( 

Desc

 )

6.2.5.4 FromPropertyDescriptor ( 

Desc

 )

6.2.5.5 ToPropertyDescriptor ( 

Obj

 )

6.2.5.6 CompletePropertyDescriptor ( 

Desc

 )

6.2.6 The Environment Record Specification Type
6.2.7 The Abstract Closure Specification Type
6.2.8 Data Blocks

6.2.8.1 CreateByteDataBlock ( 

size

 )

6.2.8.2 CreateSharedByteDataBlock ( 

size

 )

6.2.8.3 CopyDataBlockBytes ( 

toBlock

toIndex

fromBlock

fromIndex

count

 )

7 Abstract Operations

7.1 Type Conversion

7.1.1 ToPrimitive ( 

input

 [ , 

preferredType

 ] )

7.1.1.1 OrdinaryToPrimitive ( 

O

hint

 )

7.1.2 ToBoolean ( 

argument

 )

7.1.3 ToNumeric ( 

value

 )

7.1.4 ToNumber ( 

argument

 )

7.1.4.1 ToNumber Applied to the String Type

7.1.4.1.1 RS: MV

7.1.5 ToIntegerOrInfinity ( 

argument

 )

7.1.6 ToInt32 ( 

argument

 )

7.1.7 ToUint32 ( 

argument

 )

7.1.8 ToInt16 ( 

argument

 )

7.1.9 ToUint16 ( 

argument

 )

7.1.10 ToInt8 ( 

argument

 )

7.1.11 ToUint8 ( 

argument

 )

7.1.12 ToUint8Clamp ( 

argument

 )

7.1.13 ToBigInt ( 

argument

 )

7.1.14 StringToBigInt ( 

argument

 )

7.1.15 ToBigInt64 ( 

argument

 )

7.1.16 ToBigUint64 ( 

argument

 )

7.1.17 ToString ( 

argument

 )

7.1.18 ToObject ( 

argument

 )

7.1.19 ToPropertyKey ( 

argument

 )

5

a.  Append 

N

 to 

varDeclaredNames

.

8.  Return 

NormalCompletion

(

empty

).

The CreateGlobalFunctionBinding concrete method of a 

global Environment Record

 

envRec

 takes arguments 

N

 (a

String), 

V

 (an 

ECMAScript language value

), and 

D

 (a Boolean). It creates and initializes a mutable binding in the

associated 

object Environment Record

 and records the bound name in the associated [[VarNames]] 

List

. If a binding

already exists, it is replaced. It performs the following steps when called:

1.  Let 

ObjRec

 be 

envRec

.[[ObjectRecord]].

2.  Let 

globalObject

 be the binding object for 

ObjRec

.

3.  Let 

existingProp

 be ? 

globalObject

.[[GetOwnProperty]](

N

).

4.  If 

existingProp

 is 

undefined

 or 

existingProp

.[[Configurable]] is 

true

, then

a.  Let 

desc

 be the PropertyDescriptor { [[Value]]: 

V

, [[Writable]]: 

true

, [[Enumerable]]: 

true

,

[[Configurable]]: 

D

 }.

5.  Else,

a.  Let 

desc

 be the PropertyDescriptor { [[Value]]: 

V

 }.

6.  Perform ? 

DefinePropertyOrThrow

(

globalObject

N

desc

).

7.  Perform ? 

Set

(

globalObject

N

V

false

).

8.  Let 

varDeclaredNames

 be 

envRec

.[[VarNames]].

9.  If 

varDeclaredNames

 does not contain 

N

, then

a.  Append 

N

 to 

varDeclaredNames

.

10.  Return 

NormalCompletion

(

empty

).

NOTE

module Environment Record

 is a 

declarative Environment Record

 that is used to represent the outer scope of an

ECMAScript 

Module

. In additional to normal mutable and immutable bindings, module Environment Records also

provide immutable import bindings which are bindings that provide indirect access to a target binding that exists in
another 

Environment Record

.

Module Environment Records support all of the 

declarative Environment Record

 methods listed in 

Table 17

 and share

the same specifications for all of those methods except for GetBindingValue, DeleteBinding, HasThisBinding and
GetThisBinding. In addition, module Environment Records support the methods listed in 

Table 22

:

Global function declarations are always represented as own properties of the 

global object

. If

possible, an existing own property is reconfigured to have a standard set of attribute values. Step

7

 is equivalent to what calling the InitializeBinding concrete method would do and if 

globalObject

is a Proxy will produce the same sequence of Proxy trap calls.

9.1.1.4.18  CreateGlobalFunctionBinding ( 

N

V

D

 )

9.1.1.5  Module Environment Records

202

Table 22: Additional Methods of Module Environment Records

Method

Purpose

CreateImportBinding(N,
M, N2)

Create an immutable indirect binding in a 

module Environment Record

. The String value

N

 is the text of the bound name. 

M

 is a 

Module Record

, and 

N2

 is a binding that exists in

M

's 

module Environment Record

.

GetThisBinding()

Return the value of this 

Environment Record

's 

this

this

 binding.

The behaviour of the additional concrete specification methods for module Environment Records are defined by the
following algorithms:

The GetBindingValue concrete method of a 

module Environment Record

 

envRec

 takes arguments 

N

 (a String) and 

S

 (a

Boolean). It returns the value of its bound identifier whose name is the value of the argument 

N

. However, if the

binding is an indirect binding the value of the target binding is returned. If the binding exists but is uninitialized a

ReferenceError

 is thrown. It performs the following steps when called:

1. 

Assert

S

 is 

true

.

2. 

Assert

envRec

 has a binding for 

N

.

3.  If the binding for 

N

 is an indirect binding, then

a.  Let 

M

 and 

N2

 be the indirection values provided when this binding for 

N

 was created.

b.  Let 

targetEnv

 be 

M

.[[Environment]].

c.  If 

targetEnv

 is 

undefined

, throw a 

ReferenceError

 exception.

d.  Return ? 

targetEnv

.GetBindingValue(

N2

true

).

4.  If the binding for 

N

 in 

envRec

 is an uninitialized binding, throw a 

ReferenceError

 exception.

5.  Return the value currently bound to 

N

 in 

envRec

.

NOTE

The DeleteBinding concrete method of a 

module Environment Record

 is never used within this specification.

NOTE

The HasThisBinding concrete method of a 

module Environment Record

 

envRec

 takes no arguments. It performs the

following steps when called:

1.  Return 

true

.

S

 will always be 

true

 because a 

Module

 is always 

strict mode code

.

Module Environment Records are only used within strict code and an 

early error

 rule prevents

the delete operator, in strict code, from being applied to a 

Reference Record

 that would resolve to

module Environment Record

 binding. See 

13.5.1.1

.

9.1.1.5.1  GetBindingValue ( 

N

S

 )

9.1.1.5.2  DeleteBinding ( 

N

 )

9.1.1.5.3  HasThisBinding ( )

203

NOTE

The GetThisBinding concrete method of a 

module Environment Record

 

envRec

 takes no arguments. It performs the

following steps when called:

1.  Return 

undefined

.

The CreateImportBinding concrete method of a 

module Environment Record

 

envRec

 takes arguments 

N

 (a String), 

M

(a 

Module Record

), and 

N2

 (a String). It creates a new initialized immutable indirect binding for the name 

N

. A

binding must not already exist in this 

Environment Record

 for 

N

N2

 is the name of a binding that exists in 

M

's

module Environment Record

. Accesses to the value of the new binding will indirectly access the bound value of the

target binding. It performs the following steps when called:

1. 

Assert

envRec

 does not already have a binding for 

N

.

2. 

Assert

M

 is a 

Module Record

.

3. 

Assert

: When 

M

.[[Environment]] is instantiated it will have a direct binding for 

N2

.

4.  Create an immutable indirect binding in 

envRec

 for 

N

 that references 

M

 and 

N2

 as its target binding and record

that the binding is initialized.

5.  Return 

NormalCompletion

(

empty

).

The following 

abstract operations

 are used in this specification to operate upon Environment Records:

The abstract operation GetIdentifierReference takes arguments 

env

 (an 

Environment Record

 or 

null

), 

name

 (a String),

and 

strict

 (a Boolean). It performs the following steps when called:

1.  If 

env

 is the value 

null

, then

a.  Return the 

Reference Record

 { [[Base]]: 

unresolvable

, [[ReferencedName]]: 

name

, [[Strict]]: 

strict

,

[[ThisValue]]: 

empty

 }.

2.  Let 

exists

 be ? 

env

.HasBinding(

name

).

3.  If 

exists

 is 

true

, then

a.  Return the 

Reference Record

 { [[Base]]: 

env

, [[ReferencedName]]: 

name

, [[Strict]]: 

strict

, [[ThisValue]]:

empty

 }.

4.  Else,

a.  Let 

outer

 be 

env

.[[OuterEnv]].

b.  Return ? 

GetIdentifierReference

(

outer

name

strict

).

The abstract operation NewDeclarativeEnvironment takes argument 

E

 (an 

Environment Record

). It performs the

following steps when called:

Module Environment Records always provide a 

this

this

 binding.

9.1.1.5.4  GetThisBinding ( )

9.1.1.5.5  CreateImportBinding ( 

N

M

N2

 )

9.1.2  Environment Record Operations

9.1.2.1  GetIdentifierReference ( 

env

name

strict

 )

9.1.2.2  NewDeclarativeEnvironment ( 

E

 )

204

 

 

 

 

 

 

 

 

Content      ..      1       2         ..

 

 

///////////////////////////////////////