7.3.21 EnumerableOwnProperties ( O, kind )

当使用 Object 类型 O 和 String 类型调用抽象操作 EnumerableOwnProperties 时,将执行以下步骤:

  1. 断言:IsPropertyKey(P) 为 true
  2. 使 ownKeys 变为? O.[[OwnPropertyKeys]]()。
  3. 使 properties 变为一个新的空 List
  4. 重复 List 序列中的 ownKeys 的每个 key 元素,

a. 如果 Type(key) 是 String 类型,那么 i. 使 desc 变为 ? O.[[GetOwnProperty]](key)。

ii. 如果 desc 不为 undefined desc.[[Enumerable]] 为 true,,那么

  1. 如果 kind "key",则添加 key properties 上。
  2. 否则,

a. 使 value 变为? Get(O, key)。 b. 如果 kind "value",则添加 value properties 上。

c. 否则,

i. 断言:kind "key+value"

ii. 使 entry 变为 CreateArrayFromList(« key, value »)。

iii. 添加 entry properties 上。

  1. properties 的元素进行排序,使得它们处于由如果使用 O 调用 EnumerateObjectProperties 内部方法时将返回的 Iterator 产生的相同。

6.返回 properties

results matching ""

    No results matching ""