?um/p1-90`
本规范中的算法操作各种值,每个值都有关联的类型。可能的值类型
恰好就是本条款中定义的这些类型。类型还进一步分为
ECMAScript 语言类型 对应于 ECMAScript 程序员使用 ECMAScript 语言直接操作的值。 ECMAScript 语言类型包括 Undefined、Null、Boolean、String、 Symbol、Number、BigInt 和 Object。ECMAScript 语言值是指 具有某种 ECMAScript 语言类型特征的值。
Undefined 类型恰好只有一个值,称为
Null 类型恰好只有一个值,称为
Boolean 类型
表示具有两个值的逻辑实体,这两个值称为
String 类型是
所有由零个或多个 16 位无符号
不解释 String 内容的 ECMAScript 操作不会附加更多语义。那些
确实解释 String 值的操作会将每个元素视为一个 UTF-16 码元。不过,
ECMAScript 并不限制这些码元的值,也不限制它们之间的关系,因此,
那些进一步将 String 内容解释为以 UTF-16 编码的 Unicode 码点序列的
操作,必须考虑格式不良的子序列。这类操作会依据以下规则,对每个数值
位于 0xD800 到 0xDBFF
函数 String.prototype.normalize(见 String.prototype.localeCompare(见
这种设计背后的理由,是尽可能保持 String 的实现简单且高性能。
如果
在本规范中,短语“A、B、... 的字符串连接”(其中每个参数都是 String 值、码元或码元序列)表示这样一个 String 值:它的码元序列 是各参数(按顺序)中码元(按顺序)的连接结果。
短语“str 从 inclusiveStart 到 exclusiveEnd 的
子字符串”(其中 str 是 String 值或码元
序列,inclusiveStart 和 exclusiveEnd 是
短语“ASCII 单词字符”
表示下面这个 String 值,它仅由 Unicode Basic Latin 区块中的所有
字母和数字,以及 U+005F(LOW LINE)组成:
出于历史原因,它对多种算法具有意义。
The abstract operation StringIndexOf takes arguments string (一个 String,), searchValue (一个 String,), and fromIndex (一个非负
若 searchValue 是空 String 且 fromIndex ≤ string 的长度, 这个算法返回 fromIndex。空 String 实际上会在字符串中的每个位置 被找到,包括最后一个码元之后。
若 fromIndex + searchValue 的长度 > string 的长度,
此算法总是返回
The abstract operation StringLastIndexOf takes arguments string (一个 String,), searchValue (一个 String,), and fromIndex (一个非负
若 searchValue 是空 String,此算法返回 fromIndex。 空 String 实际上会在字符串中的每个位置被找到,包括最后一个码元 之后。
Symbol 类型
是所有可用作 Object
每个 Symbol 都是唯一且不可变的。
每个 Symbol 都有一个不可变的 [[Description]] 内部槽,
其值要么是一个 String,要么是
众所周知的 symbol 是由本规范算法显式引用的内建 Symbol 值。
它们通常用作属性的键,而这些属性的值充当规范算法的扩展点。除非另有
说明,众所周知的 symbol 值由所有
在本规范中,众所周知的 symbol 通过标准的
%Symbol.name%。特别地,曾使用过以下名称:
@@asyncIterator、@@hasInstance、@@isConcatSpreadable、
@@| 规范名称 | [[Description]] | 值与用途 |
|---|---|---|
| %Symbol.asyncIterator% |
|
一个方法,返回对象的默认异步迭代器。由 for-await-of
语句的语义调用。
|
| %Symbol.hasInstance% |
|
一个方法,用于确定某个instanceof 运算符的语义调用。
|
| %Symbol.isConcatSpreadable% |
|
一个 Boolean 值属性,若为 true,则表示对象应当被
Array.prototype.concat
|
| %Symbol.iterator% |
|
一个方法,返回对象的默认迭代器。由 for-of 语句的语义 调用。 |
| %Symbol.match% |
|
一个正则表达式方法,用于将正则表达式与字符串进行匹配。
由
String.prototype.match
|
| %Symbol.matchAll% |
|
一个正则表达式方法,返回一个迭代器,该迭代器会产出正则表达式
对字符串匹配得到的各个结果。由
String.prototype.matchAll
|
| %Symbol.replace% |
|
一个正则表达式方法,用于替换字符串中匹配到的String.prototype.replace
|
| %Symbol.search% |
|
一个正则表达式方法,返回字符串中匹配该正则表达式的位置索引。
由
String.prototype.search
|
| %Symbol.species% |
|
一个函数值属性,它是用于创建派生对象的 |
| %Symbol.split% |
|
一个正则表达式方法,用于在字符串中按匹配该正则表达式的索引
进行分割。由
String.prototype.split
|
| %Symbol.toPrimitive% |
|
一个方法,将对象转换为对应的原始值。由 |
| %Symbol.toStringTag% |
|
一个 String 值属性,用于创建对象的默认字符串描述。由内建
方法
Object.prototype.toString
|
| %Symbol.unscopables% |
|
一个对象值属性,其自有和继承with
环境绑定中排除的 |
ECMAScript 有两种内建数值类型:Number 和 BigInt。以下抽象
操作定义于这些数值类型之上。“Result” 列显示返回类型,并指出该操作
的某些调用是否有可能返回
由于数值类型一般无法在不丢失精度或不截断的情况下互相转换,
ECMAScript 语言不提供这些类型之间的隐式转换。当调用要求另一种类型
的函数时,程序员必须显式调用 Number 和 BigInt 函数来进行类型
转换。
ECMAScript 的第一版及后续版本,对某些运算符提供了可能丢失
精度或发生截断的隐式数值转换。出于向后兼容的考虑,这些
Number 类型
恰好有 18,437,736,874,454,810,627(即
NaN 产生。)在某些实现中,外部代码可能能够检测出不同
NaN 值之间的差异,但这种行为属于
还有另外两个特殊值,称为 +Infinity(或简写为 Infinity)和
-Infinity 产生。)
其余的 18,437,736,874,454,810,624(即
注意,既有 +0
(或简写为 0)和 -0 产生。)
18,437,736,874,454,810,622(即
其中 18,428,729,675,200,069,632(即
其中 s 为 1 或 -1,m 是位于 252(含)到
253(不含)
剩余的 9,007,199,254,740,990(即
其中 s 为 1 或 -1,m 是位于 0(不含)到
252(不含)
注意,所有绝对值不大于 253 的正
若某个
在本规范中,短语“x 的Number 值”,其中 x 表示某个精确的
实数数学量(它甚至可能是像 π 这样的无理数),是指以下方式选择出的
一个
+∞ 的
某些 ECMAScript 运算符只处理特定范围内的
The abstract operation Number::unaryMinus takes argument x (一个 Number,) and returns 一个 Number. It performs the following steps when called:
The abstract operation Number::bitwiseNOT takes argument x (一个 Number,) and returns 一个
The abstract operation Number::exponentiate takes arguments base (一个 Number,) and exponent (一个 Number,) and returns 一个 Number. 它返回一个实现近似值,表示 base 的 exponent 次幂结果。 It performs the following steps when called:
当 base 为 **
exponent 的结果与
The abstract operation Number::multiply takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个 Number. 它按照
The abstract operation Number::divide takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个 Number. 它按照
The abstract operation Number::remainder takes arguments n (一个 Number,) and d (一个 Number,) and returns 一个 Number. 它产生由操作数隐含除法所得的余数,其中 n 是被除数, d 是除数。 It performs the following steps when called:
在 C 和 C++ 中,余数运算符只接受
% 运算符计算出的浮点余数操作结果,与 % 定义为以一种类似于
Java The abstract operation Number::add takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个 Number. 它按照
The abstract operation Number::subtract takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个 Number. 它执行减法,产生操作数之差;x 是被减数,y 是减数。 It performs the following steps when called:
始终都有 x - y 产生与 x + (-y) 相同的结果。
The abstract operation Number::leftShift takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个
The abstract operation Number::signedRightShift takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个
The abstract operation Number::unsignedRightShift takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个
The abstract operation Number::lessThan takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个 Boolean 或
The abstract operation Number::equal takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个 Boolean. It performs the following steps when called:
The abstract operation Number::sameValue takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个 Boolean. It performs the following steps when called:
The abstract operation Number::sameValueZero takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个 Boolean. It performs the following steps when called:
The abstract operation NumberBitwiseOp takes arguments op (&、^ 或 |,), x (一个 Number,), and y (一个 Number,) and returns 一个
&,则^,则|。The abstract operation Number::bitwiseAND takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个
&, x, y)。The abstract operation Number::bitwiseXOR takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个
^, x, y)。The abstract operation Number::bitwiseOR takes arguments x (一个 Number,) and y (一个 Number,) and returns 一个
|, x, y)。The abstract operation Number::toString takes arguments x (一个 Number,) and radix (一个位于 2 到 36
1.2e+3。ECMAScript 的实现者可能会发现 David M. Gay 为浮点数 二进制到十进制转换所写的论文和代码很有用:
Gay, David M. Correctly Rounded Binary-Decimal and
Decimal-Binary Conversions. Numerical Analysis,
Manuscript 90-10. AT&T Bell Laboratories
(Murray Hill, New Jersey). 30 November 1990.
Available as
https://ampl.com/_archive/first-website/REFS/rounding.pdf.
Associated code available as
http://netlib.sandia.gov/fp/dtoa.c
and as
http://netlib.sandia.gov/fp/g_fmt.c
and may also be found at the various netlib
mirror sites.
BigInt 类型
表示
The abstract operation BigInt::unaryMinus takes argument x (一个 BigInt,) and returns 一个 BigInt. It performs the following steps when called:
The abstract operation BigInt::bitwiseNOT takes argument x (一个 BigInt,) and returns 一个 BigInt. 它返回 x 的一补数。 It performs the following steps when called:
The abstract operation BigInt::exponentiate takes arguments base (一个 BigInt,) and exponent (一个 BigInt,) and returns 要么是包含 BigInt 的
The abstract operation BigInt::multiply takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个 BigInt. It performs the following steps when called:
The abstract operation BigInt::divide takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 要么是包含 BigInt 的
The abstract operation BigInt::remainder takes arguments n (一个 BigInt,) and d (一个 BigInt,) and returns 要么是包含 BigInt 的
The abstract operation BigInt::add takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个 BigInt. It performs the following steps when called:
The abstract operation BigInt::subtract takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个 BigInt. It performs the following steps when called:
The abstract operation BigInt::leftShift takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个 BigInt. It performs the following steps when called:
The abstract operation BigInt::signedRightShift takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个 BigInt. It performs the following steps when called:
The abstract operation BigInt::unsignedRightShift takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个抛出完成. It performs the following steps when called:
The abstract operation BigInt::lessThan takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个 Boolean. It performs the following steps when called:
The abstract operation BigInt::equal takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个 Boolean. It performs the following steps when called:
The abstract operation BinaryAnd takes arguments x (0 或 1,) and y (0 或 1,) and returns 0 或 1. It performs the following steps when called:
The abstract operation BinaryOr takes arguments x (0 或 1,) and y (0 或 1,) and returns 0 或 1. It performs the following steps when called:
The abstract operation BinaryXor takes arguments x (0 或 1,) and y (0 或 1,) and returns 0 或 1. It performs the following steps when called:
The abstract operation BigIntBitwiseOp takes arguments op (&、^ 或 |,), x (一个 BigInt,), and y (一个 BigInt,) and returns 一个 BigInt. It performs the following steps when called:
&,则|,则^。&,则|,则The abstract operation BigInt::bitwiseAND takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个 BigInt. It performs the following steps when called:
&, x, y)。The abstract operation BigInt::bitwiseXOR takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个 BigInt. It performs the following steps when called:
^, x, y)。The abstract operation BigInt::bitwiseOR takes arguments x (一个 BigInt,) and y (一个 BigInt,) and returns 一个 BigInt. It performs the following steps when called:
|, x, y)。The abstract operation BigInt::toString takes arguments x (一个 BigInt,) and radix (一个位于 2 到 36
Object 类型 的每个实例,也简称为“一个 Object”,表示属性的集合。每个属性要么 是数据属性,要么是访问器属性:
对象的属性通过
整数索引
是这样一个
所有对象在逻辑上都是属性的集合,但对象存在多种形式,它们在
访问和操作属性的语义上有所不同。关于对象多种形式的定义,请参见
此外,某些对象是可调用的;它们被称为函数或
本规范使用特性来定义和解释 Object 属性的状态,如
| 特性名称 | 具有该特性的属性类型 | 值域 | 默认值 | 描述 |
|---|---|---|---|---|
| [[Value]] |
|
一个 |
|
对该属性执行 get 访问时获取到的值。 |
| [[Writable]] |
|
一个 Boolean |
|
若为 |
| [[Get]] |
|
一个 Object 或 |
|
若该值是一个 Object,则它必须是 |
| [[Set]] |
|
一个 Object 或 |
|
若该值是一个 Object,则它必须是 |
| [[Enumerable]] |
|
一个 Boolean |
|
若为 |
| [[Configurable]] |
|
一个 Boolean |
|
若为 |
在 ECMAScript 中,对象的实际语义是通过称为内部方法 的算法来规定的。ECMAScript 引擎中的每个对象都关联着一组定义其运行时 行为的内部方法。这些内部方法不是 ECMAScript 语言的一部分。它们仅为 说明之用而由本规范定义。然而,ECMAScript 实现中的每个对象都必须按与 其关联的内部方法所规定的方式表现。具体如何做到这一点由实现决定。
内部方法名称是多态的。这意味着,当对不同对象值调用同一个内部
方法名称时,它们可能执行不同的算法。实际被调用内部方法的那个对象称为
该调用的“目标”。如果在运行时,某个算法的实现试图使用对象不支持的
内部方法,则会抛出
内部槽对应于与对象、Symbol 或
所有对象都有一个名为 [[PrivateElements]] 的内部槽,它是
本规范中,内部方法和内部槽使用置于双重方括号 [[ ]] 中的名称 标识。
普通对象是满足以下所有条件的对象:
异质对象
是指不是
本规范通过对象的内部方法来识别不同种类的
除其参数外,内部方法始终还能够访问作为该方法调用目标的对象。
内部方法会隐式返回一个
| 内部方法 | 签名 | 描述 |
|---|---|---|
| [[GetPrototypeOf]] | ( ) → Object | Null |
确定为该对象提供继承属性的对象。 |
| [[SetPrototypeOf]] | (Object | Null) → Boolean |
将该对象与另一个提供继承属性的对象关联起来。传入 |
| [[IsExtensible]] | ( ) → Boolean | 确定是否允许向该对象添加额外属性。 |
| [[PreventExtensions]] | ( ) → Boolean |
控制是否允许向该对象添加新属性。若操作成功返回 |
| [[GetOwnProperty]] |
(propertyKey) → Undefined | |
返回该对象中键为 propertyKey 的自有属性的
|
| [[DefineOwnProperty]] | (propertyKey, propertyDescriptor) → Boolean |
创建或修改键为 propertyKey 的自有属性,使其具有
propertyDescriptor 所描述的状态。若该属性成功创建/更新
则返回 |
| [[HasProperty]] | (propertyKey) → Boolean | 返回一个 Boolean 值,指示该对象是否已经具有键为 propertyKey 的自有属性或继承属性。 |
| [[Get]] | (propertyKey, receiver) → any |
返回该对象中键为 propertyKey 的属性值。若必须执行某些
ECMAScript 代码才能获取该属性值,则在求值该代码时,
receiver 会被用作 |
| [[Set]] | (propertyKey, value, receiver) → Boolean |
将该对象中键为 propertyKey 的属性值设为 value。若必须
执行某些 ECMAScript 代码才能设置该属性值,则在求值该代码时,
receiver 会被用作 |
| [[Delete]] | (propertyKey) → Boolean |
从该对象中移除键为 propertyKey 的自有属性。若属性未被
删除且仍然存在,则返回 |
| [[OwnPropertyKeys]] |
( ) → |
返回一个 |
| 内部方法 | 签名 | 描述 |
|---|---|---|
| [[Call]] |
(any, 一个 any 的 |
执行与该对象关联的代码。通过函数调用表达式调用。传给该内部
方法的参数是一个 |
| [[Construct]] |
(一个 any 的 |
创建一个对象。通过 new 运算符或 super 调用来调用。
该内部方法的第一个参数是一个 super 调用的参数。第二个参数是最初应用 new 运算符的
对象。实现此内部方法的对象称为 |
ECMAScript 引擎中对象的内部方法必须符合下面规定的不变量列表。
普通 ECMAScript 对象以及本规范中的所有标准
实现所提供的任何
实现不得允许以任何方式绕过这些不变量,例如提供替代接口来实现 基本内部方法的功能,却不执行其不变量约束。
任何内部方法返回的值都必须是一个
内部方法不得返回 continue completion、break completion 或 return completion。
由第三个不变量可知,若某属性被描述为
众所周知的内在值是由本规范算法显式引用的内建对象,并且通常具有
特定于
在本规范中,诸如 %name% 这样的引用表示与当前
规范类型对应于算法中使用的元值,用于描述 ECMAScript 语言构造和
Enum 是规范内部使用、而不能被
ECMAScript 代码直接观察到的值。Enum 使用全大写 kebab case,并以
List 类型用于说明 new 表达式中的
参数列表(见
当算法遍历 List 的元素而未指定顺序时,所使用的顺序就是 List 中 元素的顺序。
为便于本规范中的记号表达,可以使用字面量语法来表示一个新的 List 值。例如,« 1, 2 » 定义了一个具有两个元素的 List 值,这两个元素 都被初始化为特定值。新的空 List 可表示为 « »。
在本规范中,短语“A、B、... 的列表连接”(其中每个参数都是一个可能为空 的 List)表示一个新的 List 值,其元素是各参数的元素(按顺序)连接 起来得到的结果。
对于 String 的 List,短语“按码元字典序排序”表示:按每个
码元的数值比较,比较到较短字符串的长度为止;若此前都相等,则较短字符串
排在较长字符串之前,正如
Record 类型用于描述本规范算法中
的数据聚合。一个 Record 类型值由一个或多个具名字段组成。每个字段的值
是一个
为便于本规范中的记号表达,可以使用类似对象字面量的语法来表示
Record 值。例如,{ [[Field1]]: 42, [[Field2]]:
在规范文本和算法中,可使用点记法来引用 Record 值中的某个特定 字段。例如,若 R 是前一段所示的 record,则 R.[[Field2]] 是“R 中名为 [[Field2]] 的字段”的简写。
常用 Record 字段组合的 schema 可以被命名,该名称可以作为
字面量 Record 值的前缀,以标识正在描述的特定聚合类型。例如:
PropertyDescriptor { [[Value]]: 42, [[Writable]]:
Set 类型用于说明
Relation 类型用于说明 Set 上的 约束。Relation 类型的值是由其值域中的值组成的有序对的 Set。例如, 内存事件上的 Relation 是一组内存事件的有序对。对于一个 Relation R 以及 R 值域中的两个值 a 和 b,a R b 是在说有序对 (a, b) 是 R 的成员的简写。若某个 Relation 在满足某些条件的 情况下是最小 Relation,则意味着它是 满足这些条件的最小的 Relation。
严格偏序是满足 以下条件的 Relation 值 R。
对于 R 定义域中的所有 a、b 和 c:
上述两个性质分别称为反自反性和传递性。
严格全序是满足以下 条件的 Relation 值 R。
对于 R 定义域中的所有 a、b 和 c:
上述三个性质分别称为全性、反自反性和传递性。
Completion Record
规范类型用于说明值和控制流在运行时的传播,例如执行非局部控制转移的
语句(break、continue、return 和 throw)的行为。
Completion Record 具有
| 字段名称 | 值 | 含义 |
|---|---|---|
| [[Type]] |
|
发生的完成类型。 |
| [[Value]] |
任何值,但不能是 |
所产生的值。 |
| [[Target]] |
一个 String 或 |
定向控制转移的目标标签。 |
下面这些简写术语有时用于指代 Completion Record。
本规范中定义的可调用对象只返回正常完成或抛出完成。返回其他任何 种类的 Completion Record 都被视为编辑错误。
The abstract operation NormalCompletion takes argument value (任何值,但不能是
The abstract operation ThrowCompletion takes argument value (一个
The abstract operation ReturnCompletion takes argument value (一个
The abstract operation UpdateEmpty takes arguments completionRecord (一个
Reference Record 类型
用于说明诸如 delete、typeof、赋值运算符、super
Reference Record 是一个已解析的名称绑定,或一个(可能尚未解析
的)属性绑定;它的字段由
| 字段名称 | 值 | 含义 |
|---|---|---|
| [[Base]] | 一个 |
持有该绑定的值或 |
| [[ReferencedName]] | 一个 |
绑定的名称。若 [[Base]] 值是 |
| [[Strict]] | 一个 Boolean | 若该 |
| [[ThisValue]] | 一个 |
若不是 super |
本规范使用以下
The abstract operation IsPropertyReference takes argument referenceRecord (一个
The abstract operation IsUnresolvableReference takes argument referenceRecord (一个
The abstract operation IsSuperReference takes argument referenceRecord (一个
The abstract operation IsPrivateReference takes argument referenceRecord (一个
The abstract operation GetValue takes argument referenceRecord (a
The abstract operation PutValue takes arguments referenceRecord (a
The abstract operation GetThisValue takes argument referenceRecord (一个
The abstract operation InitializeReferencedBinding takes arguments referenceRecord (一个
The abstract operation MakePrivateReference takes arguments baseValue (一个
Property Descriptor
类型用于说明 Object 属性特性的操作和具体化。Property Descriptor 是
一个具有零个或多个字段的
Property Descriptor 值还可以根据某些字段的存在或使用进一步分为
数据 Property Descriptor 和访问器 Property Descriptor。数据
Property Descriptor 是包含名为 [[Value]] 或 [[Writable]] 的任一字段
的 Property Descriptor。访问器 Property Descriptor 是包含名为
[[Get]] 或 [[Set]] 的任一字段的 Property Descriptor。任何
Property Descriptor 都可以包含名为 [[Enumerable]] 和 [[Configurable]]
的字段。一个 Property Descriptor 值不能同时既是数据 Property
Descriptor 又是访问器 Property Descriptor;不过,它也可以两者都不是
(此时称为通用 Property Descriptor)。完整填充的 Property
Descriptor 是指:它要么是访问器 Property Descriptor,要么是
数据 Property Descriptor,并且具有
本规范使用以下
The abstract operation IsAccessorDescriptor takes argument desc (一个
The abstract operation IsDataDescriptor takes argument desc (一个
The abstract operation IsGenericDescriptor takes argument desc (一个
The abstract operation FromPropertyDescriptor takes argument desc (一个
The abstract operation ToPropertyDescriptor takes argument obj (一个
The abstract operation CompletePropertyDescriptor takes argument desc (一个
Abstract Closure
规范类型用于引用一组算法步骤及一组值。Abstract Closure 是元值,并使用
函数应用风格调用,例如 closure(arg1, arg2)。与
在创建 Abstract Closure 的算法步骤中,值通过动词 “capture” 后跟一组别名来捕获。当创建 Abstract Closure 时,它会捕获当时与每个 别名相关联的值。在规定调用 Abstract Closure 时应执行的算法步骤中, 每个被捕获的值都通过用来捕获它的那个别名来引用。
若某个 Abstract Closure 返回
Abstract Closure 作为其他算法的一部分被内联创建,如下例所示。
Data Block 规范类型用于描述一段
独立且可变的、由字节大小(8 位)数值构成的序列。字节值是位于 0 到 255
为便于本规范中的记号表达,可以使用类似数组的语法来访问 Data Block 值中的单个字节。该记法将 Data Block 值表现为一个以 0 为起始索引 的字节序列。比如,若 db 是一个 5 字节的 Data Block 值,则可使用 db[2] 来访问它的第 3 个字节。
驻留在可被多个
Shared Data Block 的语义由
Shared Data Block 事件通过
本规范使用以下
The abstract operation CreateByteDataBlock takes argument size (一个非负
The abstract operation CreateSharedByteDataBlock takes argument size (一个非负
The abstract operation CopyDataBlockBytes takes arguments toBlock (一个
PrivateElement 类型是一个
PrivateElement 类型的值是字段由
| 字段名称 | 具有该字段的 [[Kind]] 字段值 | 值 | 含义 |
|---|---|---|---|
| [[Key]] | 全部 |
一个 |
字段、方法或访问器的名称。 |
| [[Kind]] | 全部 |
|
元素的种类。 |
| [[Value]] |
|
一个 |
字段的值。 |
| [[Get]] |
|
一个 |
私有访问器的 getter。 |
| [[Set]] |
|
一个 |
私有访问器的 setter。 |
ClassFieldDefinition 类型是一个
ClassFieldDefinition 类型的值是字段由
| 字段名称 | 值 | 含义 |
|---|---|---|
| [[Name]] |
一个 |
字段的名称。 |
| [[Initializer]] |
一个 ECMAScript |
字段的初始化器(若存在)。 |
Private Name 规范类型用于
描述一种全局唯一值(它不同于任何其他 Private Name,即使它们在其他方面
无法区分),该值表示私有类元素(字段、方法或访问器)的键。每个
Private Name 都有一个不可变的 [[Description]] 内部槽,其值为一个
String。Private Name 可通过
ClassStaticBlockDefinition Record
是一种
ClassStaticBlockDefinition Record 具有
| 字段名称 | 值 | 含义 |
|---|---|---|
| [[BodyFunction]] |
一个 ECMAScript |
在类的静态初始化期间被调用的 |