7.3.21 EnumerableOwnProperties ( O, kind )
当使用 Object 类型 O 和 String 类型调用抽象操作 EnumerableOwnProperties 时,将执行以下步骤:
- 断言:IsPropertyKey(P) 为 true。
- 使 ownKeys 变为? O.[[OwnPropertyKeys]]()。
- 使 properties 变为一个新的空 List。
- 重复 List 序列中的 ownKeys 的每个 key 元素,
a. 如果 Type(key) 是 String 类型,那么 i. 使 desc 变为 ? O.[[GetOwnProperty]](key)。
ii. 如果 desc 不为 undefined 和 desc.[[Enumerable]] 为 true,,那么
- 如果 kind 为 "key",则添加 key 到 properties 上。
- 否则,
a. 使 value 变为? Get(O, key)。 b. 如果 kind 是 "value",则添加 value 到 properties 上。
c. 否则,
i. 断言:kind 是 "key+value"。
ii. 使 entry 变为 CreateArrayFromList(« key, value »)。
iii. 添加 entry 到 properties 上。
- 对 properties 的元素进行排序,使得它们处于由如果使用 O 调用 EnumerateObjectProperties 内部方法时将返回的 Iterator 产生的相同。
6.返回 properties。