?um/p1-90`本规范中的算法会操作各种值,每个值都有一个相关联的类型。可能的值类型正是本条款中定义的那些类型。类型进一步分类为
ECMAScript 语言类型对应于 ECMAScript 程序员使用 ECMAScript 语言直接操作的值。ECMAScript 语言类型是 Undefined、Null、Boolean、String、Symbol、Number、BigInt 和 Object。ECMAScript 语言值是由 ECMAScript 语言类型刻画的值。
Undefined 类型恰好有一个值,称为
Null 类型恰好有一个值,称为
Boolean 类型表示具有两个值的逻辑实体,这两个值称为
String 类型是所有由零个或多个 16 位无符号整数值(“元素”)组成的有序序列的集合,最大长度为 253 - 1 个元素。String 类型通常用于表示运行中的 ECMAScript 程序里的文本数据,在这种情况下,String 中的每个元素都被视为 UTF-16 码元值。每个元素都被认为在序列中占据一个位置。这些位置使用非负
不解释 String 内容的 ECMAScript 操作不施加进一步语义。解释 String 值的操作将每个元素视为单个 UTF-16 码元。然而,ECMAScript 不限制这些码元的值或它们之间的关系,因此,将 String 内容进一步解释为以 UTF-16 编码的 Unicode 码点序列的操作,必须考虑格式不良的子序列。这类操作会按照以下规则,对数值位于从 0xD800 到 0xDBFF 的
函数 String.prototype.normalize(参见 String.prototype.localeCompare(参见
此设计背后的理由是,使 Strings 的实现尽可能简单且高性能。如果 ECMAScript 源文本采用 Normalized Form C,则只要字符串字面量不
在本规范中,短语“A、B、... 的字符串连接”(其中每个实参都是 String 值、码元或码元序列)表示一个 String 值,其码元序列是每个实参的码元(按顺序)的连接(按顺序)。
短语“string 从 inclusiveStart 到 exclusiveEnd 的子字符串”(其中 string 是 String 值或码元序列,inclusiveStart 和 exclusiveEnd 是整数)表示由 string 中从索引 inclusiveStart 开始并在索引 exclusiveEnd 之前立即结束的连续码元组成的 String 值(当 inclusiveStart = exclusiveEnd 时为空 String)。如果省略 "to" 后缀,则使用 string 的长度作为 exclusiveEnd 的值。
短语“ASCII 单词字符”表示以下 String 值,该值仅由 Unicode Basic Latin 块中的每个字母和数字以及 U+005F(LOW LINE)组成:
出于历史原因,它对各种算法具有意义。
The abstract operation StringIndexOf takes arguments string (a String), searchValue (a String), and fromIndex (a non-negative
如果 searchValue 为空 String 且 fromIndex ≤ string 的长度,则该算法返回 fromIndex。空 String 实际上会在字符串内的每个位置被找到,包括最后一个码元之后。
如果 fromIndex + searchValue 的长度 > string 的长度,则该算法始终返回
The abstract operation StringLastIndexOf takes arguments string (a String), searchValue (a String), and fromIndex (a non-negative
如果 searchValue 为空 String,则该算法返回 fromIndex。空 String 实际上会在字符串内的每个位置被找到,包括最后一个码元之后。
Symbol 类型是所有可用作 Object
每个 Symbol 都是唯一且不可变的。
每个 Symbol 都有一个不可变的 [[Description]] 内部槽,其值为 String 或
众所周知的 symbols 是由本规范的算法显式引用的内置 Symbol 值。它们通常用作属性的键,而这些属性的值充当规范算法的扩展点。除非另有规定,众所周知的 symbol 值由所有
在本规范中,使用标准
%Symbol.name%。特别地,曾使用以下名称:@@asyncIterator、@@hasInstance、@@isConcatSpreadable、@@| 规范名称 | [[描述]] | 值和用途 |
|---|---|---|
| %Symbol.asyncDispose% |
|
一个方法,用于在对象上异步执行资源清理。当其await using 声明调用。
|
| %Symbol.asyncIterator% |
|
一个方法,用于返回对象的默认异步迭代器。由 for-await-of 语句的语义调用。
|
| %Symbol.dispose% |
|
一个方法,用于在对象上执行显式资源清理。当其using 声明调用。
|
| %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% |
|
一个 function 值属性,它是用于创建派生对象的 |
| %Symbol.split% |
|
一个正则表达式方法,用于在与正则表达式匹配的索引处拆分字符串。由 String.prototype.split |
| %Symbol.toPrimitive% |
|
一个方法,用于将对象转换为对应的原始值。由 |
| %Symbol.toStringTag% |
|
一个 String 值属性,用于创建对象的默认字符串描述。由内置方法 Object.prototype.toString |
| %Symbol.unscopables% |
|
一个 object 值属性,其自身和继承的with 环境绑定中排除的 |
ECMAScript 有两个内置数值类型:Number 和 BigInt。以下
由于数值类型通常不能在不损失精度或截断的情况下相互转换,ECMAScript 语言不在这些类型之间提供隐式转换。调用需要另一种类型的函数时,程序员必须显式调用 Number 和 BigInt 函数以在类型之间转换。
ECMAScript 的第一版及后续版本曾为某些运算符提供可能损失精度或截断的隐式数值转换。为了向后兼容,这些遗留隐式转换被保留,但未为 BigInt 提供,以尽量减少程序员出错的机会,并为未来版本中的通用值类型选项留下空间。
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(
剩余的 9,007,199,254,740,990(即
其中 s 为 1 或 -1,m 是从 0(排除)到 252(排除)的
注意,所有大小不超过 253 的正整数和负整数都可在 Number 类型中表示。整数 0 在 Number 类型中有两种表示:
如果
在本规范中,短语“x 的Number 值”,其中 x 表示一个精确的实数数学量(甚至可能是 π 这样的无理数),是指按以下方式选择的
+∞ 的
某些 ECMAScript 运算符只处理特定范围内的整数,例如从
The abstract operation Number::unaryMinus takes argument number (a Number) and returns a Number. It performs the following steps when called:
The abstract operation Number::bitwiseNOT takes argument number (a Number) and returns an
The abstract operation Number::exponentiate takes arguments base (a Number) and exponent (a Number) and returns a Number. 它返回一个实现近似值,表示 base 的 exponent 次幂结果。 It performs the following steps when called:
当 base 为 ** exponent 的结果不同于
The abstract operation Number::multiply takes arguments x (a Number) and y (a Number) and returns a Number. 它按照
The abstract operation Number::divide takes arguments x (a Number) and y (a Number) and returns a Number. 它按照
The abstract operation Number::remainder takes arguments numerator (a Number) and denominator (a Number) and returns a Number. 它产生由其操作数的隐含除法得到的余数,其中 numerator 是被除数,denominator 是除数。 It performs the following steps when called:
在 C 和 C++ 中,余数运算符只接受整数操作数;在 ECMAScript 中,它也接受浮点操作数。
% 运算符计算的浮点余数操作的结果,与 % 定义为以类似于 Java The abstract operation Number::add takes arguments x (a Number) and y (a Number) and returns a Number. 它按照
The abstract operation Number::subtract takes arguments x (a Number) and y (a Number) and returns a Number. 它执行减法,产生其操作数之差;x 是被减数,y 是减数。 It performs the following steps when called:
x - y 始终产生与 x + (-y) 相同的结果。
The abstract operation Number::leftShift takes arguments x (a Number) and y (a Number) and returns an
The abstract operation Number::signedRightShift takes arguments x (a Number) and y (a Number) and returns an
The abstract operation Number::unsignedRightShift takes arguments x (a Number) and y (a Number) and returns an
The abstract operation Number::lessThan takes arguments x (a Number) and y (a Number) and returns a Boolean or
The abstract operation Number::equal takes arguments x (a Number) and y (a Number) and returns a Boolean. It performs the following steps when called:
The abstract operation Number::sameValue takes arguments x (a Number) and y (a Number) and returns a Boolean. It performs the following steps when called:
The abstract operation Number::sameValueZero takes arguments x (a Number) and y (a Number) and returns a Boolean. It performs the following steps when called:
The abstract operation NumberBitwiseOp takes arguments op (&, ^, or |), x (a Number), and y (a Number) and returns an
&,则^,则|。The abstract operation Number::bitwiseAND takes arguments x (a Number) and y (a Number) and returns an
&, x, y)。The abstract operation Number::bitwiseXOR takes arguments x (a Number) and y (a Number) and returns an
^, x, y)。The abstract operation Number::bitwiseOR takes arguments x (a Number) and y (a Number) and returns an
|, x, y)。The abstract operation Number::toString takes arguments x (a Number) and radix (an
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. 可获取为
https://ampl.com/_archive/first-website/REFS/rounding.pdf。关联代码可获取为
http://netlib.sandia.gov/fp/dtoa.c 和
http://netlib.sandia.gov/fp/g_fmt.c,也可在各种 netlib 镜像站点找到。
BigInt 类型表示整数值。该值可以是任意大小,且不限于特定位宽。通常,除非另有说明,操作被设计为返回基于精确数学的答案。对于二元操作,BigInts 表现为二进制补码二进制字符串,负数被视为在左侧无限设置位。
The abstract operation BigInt::unaryMinus takes argument bigint (a BigInt) and returns a BigInt. It performs the following steps when called:
The abstract operation BigInt::bitwiseNOT takes argument bigint (a BigInt) and returns a BigInt. 它返回 bigint 的一补数。 It performs the following steps when called:
The abstract operation BigInt::exponentiate takes arguments base (a BigInt) and exponent (a BigInt) and returns either a normal completion containing a BigInt or a throw completion. It performs the following steps when called:
The abstract operation BigInt::multiply takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:
The abstract operation BigInt::divide takes arguments x (a BigInt) and y (a BigInt) and returns either a normal completion containing a BigInt or a throw completion. It performs the following steps when called:
The abstract operation BigInt::remainder takes arguments numerator (a BigInt) and denominator (a BigInt) and returns either a normal completion containing a BigInt or a throw completion. It performs the following steps when called:
The abstract operation BigInt::add takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:
The abstract operation BigInt::subtract takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:
The abstract operation BigInt::leftShift takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:
The abstract operation BigInt::signedRightShift takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:
The abstract operation BigInt::unsignedRightShift takes arguments x (a BigInt) and y (a BigInt) and returns a throw completion. It performs the following steps when called:
The abstract operation BigInt::lessThan takes arguments x (a BigInt) and y (a BigInt) and returns a Boolean. It performs the following steps when called:
The abstract operation BigInt::equal takes arguments x (a BigInt) and y (a BigInt) and returns a Boolean. It performs the following steps when called:
The abstract operation BinaryAnd takes arguments x (0 or 1) and y (0 or 1) and returns 0 or 1. It performs the following steps when called:
The abstract operation BinaryOr takes arguments x (0 or 1) and y (0 or 1) and returns 0 or 1. It performs the following steps when called:
The abstract operation BinaryXor takes arguments x (0 or 1) and y (0 or 1) and returns 0 or 1. It performs the following steps when called:
The abstract operation BigIntBitwiseOp takes arguments op (&, ^, or |), x (a BigInt), and y (a BigInt) and returns a BigInt. It performs the following steps when called:
&,则|,则^。&,则|,则The abstract operation BigInt::bitwiseAND takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:
&, x, y)。The abstract operation BigInt::bitwiseXOR takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:
^, x, y)。The abstract operation BigInt::bitwiseOR takes arguments x (a BigInt) and y (a BigInt) and returns a BigInt. It performs the following steps when called:
|, x, y)。The abstract operation BigInt::toString takes arguments x (a BigInt) and radix (an
Object 类型的每个实例,也简称为“一个 Object”,表示一组属性。每个属性要么是数据属性,要么是访问器属性:
对象的属性使用
整数索引是一个
所有对象在逻辑上都是属性的集合,但对象有多种形式,它们在访问和操作其属性时的语义不同。关于对象多种形式的定义,请参见
此外,一些对象是可调用的;这些对象称为函数或
本规范使用特性来定义和解释 Object 属性的状态,如
| 特性名称 | 它出现于哪类属性 | 值域 | 默认值 | 描述 |
|---|---|---|---|---|
| [[Value]] |
|
一个 |
|
对该属性执行 get 访问时取回的值。 |
| [[Writable]] |
|
一个 Boolean |
|
如果为 |
| [[Get]] |
|
一个 Object 或 |
|
如果该值是 Object,则它必须是 |
| [[Set]] |
|
一个 Object 或 |
|
如果该值是 Object,则它必须是 |
| [[Enumerable]] |
|
一个 Boolean |
|
如果为 |
| [[Configurable]] |
|
一个 Boolean |
|
如果为 |
在 ECMAScript 中,对象的实际语义是通过称为内部方法的算法指定的。ECMAScript 引擎中的每个对象都与一组内部方法相关联,这组内部方法定义其运行时行为。这些内部方法不是 ECMAScript 语言的一部分。它们纯粹为了说明目的由本规范定义。然而,ECMAScript 实现中的每个对象都必须按照与其关联的内部方法所指定的方式行为。完成此事的确切方式由实现决定。
内部方法名是多态的。这意味着在对不同对象值调用一个共同的内部方法名时,它们可能执行不同的算法。被调用内部方法所作用的实际对象是该调用的“目标”。如果在运行时,某个算法的实现尝试使用对象不支持的内部方法,则抛出
内部槽对应于与对象、Symbols 或
所有对象都有一个名为 [[PrivateElements]] 的内部槽,它是
内部方法和内部槽在本规范中使用双中括号 [[ ]] 括起的名称来标识。
普通对象是满足以下所有条件的对象:
异质对象是不是
本规范通过这些对象的内部方法识别不同种类的
除形参之外,内部方法始终能够访问作为方法调用目标的对象。
内部方法隐式返回一个
| 内部方法 | 签名 | 描述 |
|---|---|---|
| [[GetPrototypeOf]] | ( ) → Object | Null |
确定为此对象提供继承属性的对象。 |
| [[SetPrototypeOf]] | (Object | Null) → Boolean |
将此对象与另一个提供继承属性的对象相关联。传入 |
| [[IsExtensible]] | ( ) → Boolean | 确定是否允许向此对象添加额外属性。 |
| [[PreventExtensions]] | ( ) → Boolean |
控制是否可以向此对象添加新属性。如果操作成功则返回 |
| [[GetOwnProperty]] |
(propertyKey) → Undefined | |
返回此对象中键为 propertyKey 的自有属性的 |
| [[DefineOwnProperty]] | (propertyKey, propertyDesc) → Boolean |
创建或变更键为 propertyKey 的自有属性,使其具有 propertyDesc 描述的状态。如果该属性被成功创建/更新,则返回 |
| [[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, a |
执行与此对象相关联的代码。通过函数调用表达式调用。该内部方法的实参是一个 |
| [[Construct]] |
(a |
创建一个对象。通过 new 运算符或 super 调用来调用。该内部方法的第一个实参是一个 super 调用的实参。第二个实参是 new 运算符最初应用到的对象。实现此内部方法的对象称为 |
ECMAScript 引擎中对象的内部方法必须符合下方指定的不变式列表。普通 ECMAScript Objects 以及本规范中的所有标准
任何实现提供的
实现不得允许以任何方式绕过这些不变式,例如提供替代接口来实现基本内部方法的功能却不强制执行其不变式。
任何内部方法返回的值必须是一个
内部方法不得返回
作为第三个不变式的结果,如果某属性被描述为
众所周知的内在是由本规范的算法显式引用的内置对象,并且它们通常具有
在本规范中,诸如 %name% 的引用表示与当前
| 内在名称 | 全局名称 | ECMAScript 语言关联 |
|---|---|---|
|
|
|
AggregateError |
|
|
|
Array |
|
|
|
ArrayBuffer |
|
|
|
|
|
|
|
AsyncDisposableStack |
|
|
|
|
|
|
async function 对象的 |
|
|
|
async generator function 对象的 |
|
|
|
async generator 对象的原型( |
|
|
|
所有标准内置 |
|
|
|
|
Atomics 对象( |
|
|
|
BigInt |
|
|
|
BigInt64Array |
|
|
|
BigUint64Array |
|
|
|
Boolean |
|
|
|
DataView |
|
|
|
Date |
|
|
|
decodeURI 函数( |
|
|
|
decodeURIComponent 函数( |
|
|
|
DisposableStack |
|
|
|
encodeURI 函数( |
|
|
|
encodeURIComponent 函数( |
|
|
|
Error |
|
|
|
eval 函数( |
|
|
|
EvalError |
|
|
|
FinalizationRegistry |
|
|
|
Float16Array |
|
|
|
Float32Array |
|
|
|
Float64Array |
|
|
|
|
|
|
|
Function |
|
|
generator function 对象的 |
|
|
|
generator 对象的原型( |
|
|
|
|
Int8Array |
|
|
|
Int16Array |
|
|
|
Int32Array |
|
|
|
isFinite 函数( |
|
|
|
isNaN 函数( |
|
|
|
Iterator |
|
|
|
|
|
|
|
JSON 对象( |
|
|
|
Map |
|
|
|
|
|
|
|
Math 对象( |
|
|
|
Number |
|
|
|
Object |
|
|
|
parseFloat 函数( |
|
|
|
parseInt 函数( |
|
|
|
Promise |
|
|
|
Proxy |
|
|
|
RangeError |
|
|
|
ReferenceError |
|
|
|
Reflect 对象( |
|
|
|
RegExp |
|
|
|
|
|
|
|
Set |
|
|
|
|
|
|
|
SharedArrayBuffer |
|
|
|
String |
|
|
|
|
|
|
|
SuppressedError |
|
|
|
Symbol |
|
|
|
SyntaxError |
|
|
一个无条件抛出 |
|
|
|
所有 typed Array |
|
|
|
|
TypeError |
|
|
|
Uint8Array |
|
|
|
Uint8ClampedArray |
|
|
|
Uint16Array |
|
|
|
Uint32Array |
|
|
|
URIError |
|
|
|
WeakMap |
|
|
|
WeakRef |
|
|
|
WeakSet |
|
|
Iterator.from 返回的 wrapped |
规范类型对应于在算法中用于描述 ECMAScript 语言构造和
Enums 是规范内部的值,不能从 ECMAScript 代码中直接观察到。Enums 使用
List 类型用于解释 new 表达式、函数调用以及其他需要简单有序值列表的算法中实参列表(参见
当算法在未指定顺序的情况下迭代 List 的元素时,所使用的顺序是该 List 中元素的顺序。
为了本规范中的记号方便,可以使用字面量语法表示一个新的 List 值。例如,« 1, 2 » 定义一个具有两个元素的 List 值,每个元素都初始化为特定值。新的空 List 可以表示为 « »。
在本规范中,短语“A、B、... 的列表连接”(其中每个实参都是可能为空的 List)表示一个新的 List 值,其元素是每个实参的元素(按顺序)的连接(按顺序)。
当应用于 Strings 的 List 时,短语“按字典序码元顺序排序”意味着按每个码元的数值排序,直到较短字符串的长度为止;如果全部相等,则将较短字符串排在较长字符串之前,如
Record 类型用于描述本规范算法中的数据聚合。一个 Record 类型值由一个或多个命名字段组成。每个字段的值是
为了本规范中的记号方便,可以使用类似对象字面量的语法来表示一个 Record 值。例如,{ [[Field1]]: 42, [[Field2]]:
在规范文本和算法中,可以使用点记号来引用 Record 值的特定字段。例如,如果 R 是上一段所示的 record,则 R.[[Field2]] 是“R 中名为 [[Field2]] 的字段”的简写。
常用 Record 字段组合的模式可以被命名,并且该名称可用作字面量 Record 值的前缀,以标识所描述的聚合的具体种类。例如:PropertyDescriptor { [[Value]]: 42, [[Writable]]:
Set 类型用于解释
Relation 类型用于解释 Sets 上的约束。Relation 类型的值是其值域中值的有序对的 Sets。例如,Memory 事件上的 Relation 是 Memory 事件的有序对集合。对于 Relation R 以及 R 的值域中的两个值 a 和 b,a R b 是“有序对 (a, b) 是 R 的成员”的简写。当某个 Relation 是满足某些条件的
严格偏序是满足以下条件的 Relation 值 R。
对于 R 的域中的所有 a、b 和 c:
上述两个性质分别称为反自反性和传递性。
严格全序是满足以下条件的 Relation 值 R。
对于 R 的域中的所有 a、b 和 c:
上述三个性质分别称为全性、反自反性和传递性。
Completion Record 规范类型用于解释值和控制流的运行时传播,例如执行非局部控制转移的语句(break、continue、return 和 throw)的行为。
Completion Records 具有
| 字段名 | 值 | 含义 |
|---|---|---|
| [[Type]] |
|
所发生完成的类型。 |
| [[Value]] |
除 |
所产生的值。 |
| [[Target]] |
String 或 |
定向控制转移的目标标签。 |
以下简写术语有时用于指代 Completion Records。
本规范中定义的可调用对象只返回正常完成或抛出完成。返回任何其他种类的 Completion Record 都被认为是编辑错误。
The abstract operation NormalCompletion takes argument value (any value except a
The abstract operation ThrowCompletion takes argument value (an ECMAScript language value) and returns a throw completion. It performs the following steps when called:
The abstract operation ReturnCompletion takes argument value (an ECMAScript language value) and returns a return completion. It performs the following steps when called:
The abstract operation UpdateEmpty takes arguments completionRecord (a
Reference Record 类型用于解释 delete、typeof、赋值运算符、super
Reference Record 是已解析名称或(可能尚未解析的)属性绑定;其字段由
| 字段名 | 值 | 含义 |
|---|---|---|
| [[Base]] | 保存绑定的值或 |
|
| [[ReferencedName]] | 绑定的名称。如果 [[Base]] 值是 |
|
| [[Strict]] | Boolean | 如果 |
| [[ThisValue]] | 如果不是 super |
以下
The abstract operation IsPropertyReference takes argument refRecord (a
The abstract operation IsUnresolvableReference takes argument refRecord (a
The abstract operation IsSuperReference takes argument refRecord (a
The abstract operation IsPrivateReference takes argument refRecord (a
The abstract operation GetValue takes argument refRecord (a
The abstract operation PutValue takes arguments refRecord (a
The abstract operation GetThisValue takes argument refRecord (a
The abstract operation InitializeReferencedBinding takes arguments refRecord (a
The abstract operation MakePrivateReference takes arguments baseValue (an ECMAScript language value) and privateIdentifier (a String) and returns a
Property Descriptor 类型用于解释 Object 属性特性的操作和具象化。Property Descriptor 是具有零个或多个字段的
Property Descriptor 值可以根据某些字段的存在或使用进一步分类为数据 Property Descriptors 和访问器 Property Descriptors。数据 Property Descriptor 是
以下
The abstract operation IsAccessorDescriptor takes argument propertyDesc (a
The abstract operation IsDataDescriptor takes argument propertyDesc (a
The abstract operation IsGenericDescriptor takes argument propertyDesc (a
The abstract operation FromPropertyDescriptor takes argument propertyDesc (a
The abstract operation ToPropertyDescriptor takes argument obj (an ECMAScript language value) and returns either a normal completion containing a
The abstract operation CompletePropertyDescriptor takes argument propertyDesc (a
Abstract Closure 规范类型用于指代算法步骤以及一组值。Abstract Closures 是元值,并使用函数应用样式调用,例如 closure(arg1, arg2)。与
在创建 Abstract Closure 的算法步骤中,使用动词“capture”后跟别名列表来捕获值。创建 Abstract Closure 时,它会捕获当时与每个别名相关联的值。在指定调用 Abstract Closure 时所执行算法的步骤中,每个被捕获的值都由用于捕获该值的别名引用。
如果 Abstract Closure 返回
Abstract Closures 作为其他算法的一部分内联创建,如以下示例所示。
Data Block 规范类型用于描述一个由字节大小(8 位)数值组成的、不同且可变的序列。字节值是从 0 到 255 的
为了本规范中的记号方便,可以使用类似数组的语法来访问 Data Block 值的各个字节。此记号将 Data Block 值呈现为一个从 0 开始的
驻留在可由多个
Shared Data Blocks 的语义由
Shared Data Block 事件由
以下
The abstract operation CreateByteDataBlock takes argument size (a non-negative
The abstract operation CreateSharedByteDataBlock takes argument size (a non-negative
The abstract operation CopyDataBlockBytes takes arguments toBlock (a
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 Records 具有
| 字段名 | 值 | 含义 |
|---|---|---|
| [[BodyFunction]] |
ECMAScript |
在类的静态初始化期间要调用的 |