Skip to content

Commit

Permalink
Normative: Match ECMA‑262 function property enumeration order
Browse files Browse the repository at this point in the history
  • Loading branch information
ExE-Boss committed Sep 3, 2020
1 parent 02abd62 commit 717ffdb
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -11186,8 +11186,16 @@ default interfaces do not have such steps.
1. Let |constructorProto| be |realm|.\[[Intrinsics]].[[{{%Function.prototype%}}]].
1. If |I| inherits from some other interface |P|,
then set |constructorProto| to the [=interface object=] of |P| in |realm|.
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « \[[Unforgeables]] »,
1. Let |length| be 0.
1. If |I| was declared with a [=constructor operation=], then
1. [=Compute the effective overload set=] for constructors with [=identifier=] |id| on
[=interface=] |I| and with argument count 0, and let |S| be the result.
1. Set |length| to the length of the
shortest argument list of the entries in |S|.
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « \[[Unforgeables]] »,
|realm|, |constructorProto|).
1. Perform [=!=] [$SetFunctionLength$](|F|, |length|).
1. Perform [=!=] [$SetFunctionName$](|F|, |id|).
1. Let |unforgeables| be [=!=] [$OrdinaryObjectCreate$](<emu-val>null</emu-val>).
1. [=Define the unforgeable regular operations=] of |I| on |unforgeables|, given |realm|.
1. [=Define the unforgeable regular attributes=] of |I| on |unforgeables|, given |realm|.
Expand All @@ -11197,14 +11205,6 @@ default interfaces do not have such steps.
of an interface with an unforgeable member use the same JavaScript function objects for
[=attribute getters=], [=attribute setters=] and [=creating an operation
function|operation functions=].
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
1. Let |length| be 0.
1. If |I| was declared with a [=constructor operation=], then
1. [=Compute the effective overload set=] for constructors with [=identifier=] |id| on
[=interface=] |I| and with argument count 0, and let |S| be the result.
1. Set |length| to the length of the
shortest argument list of the entries in |S|.
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, |length|).
1. Let |proto| be the result of [=create an interface prototype object|creating an interface
prototype object=] of [=interface=] |I| in |realm|.
1. Perform [=!=] <a abstract-op>DefinePropertyOrThrow</a>(|F|, "<code>prototype</code>",
Expand Down Expand Up @@ -11250,12 +11250,12 @@ implement the interface on which the
1. Assert: |O| is an object that [=implements=] |I|.
1. Assert: |O|.\[[Realm]] is |realm|.
1. Return |O|.
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
1. [=Compute the effective overload set=] for legacy factory functions with [=identifier=] |id|
on [=interface=] |I| and with argument count 0, and let |S| be the result.
1. Let |length| be the length of the shortest argument list of the entries in |S|.
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, |length|).
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionLength$](|F|, |length|).
1. Perform [=!=] [$SetFunctionName$](|F|, |id|).
1. Let |proto| be the [=interface prototype object=] of [=interface=] |I| in |realm|.
1. Perform [=!=] <a abstract-op>DefinePropertyOrThrow</a>(|F|, "<code>prototype</code>",
PropertyDescriptor{\[[Value]]: |proto|, \[[Writable]]: <emu-val>false</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>false</emu-val>}).
Expand Down Expand Up @@ -11604,10 +11604,10 @@ in which case they are exposed on every object that [=implements=] the interface
1. If |attribute|'s type is a [=promise type=], then return
[=!=] <a abstract-op>Call</a>({{%Promise.reject%}}, {{%Promise%}}, «|E|»).
1. Otherwise, end these steps and allow the exception to propagate.
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
1. Let |name| be the string "<code>get </code>" prepended to |attribute|'s [=identifier=].
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |name|).
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, 0).
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
1. Perform [=!=] [$SetFunctionName$](|F|, |name|).
1. Return |F|.

</div>
Expand Down Expand Up @@ -11690,10 +11690,10 @@ in which case they are exposed on every object that [=implements=] the interface
1. Perform the [=setter steps=] of |attribute|,
with |idlObject| as [=this=] and |idlValue| as [=the given value=].
1. Return <emu-val>undefined</emu-val>
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
1. Let |name| be the string "<code>set </code>" prepended to |id|.
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |name|).
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, 1).
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionLength$](|F|, 1).
1. Perform [=!=] [$SetFunctionName$](|F|, |name|).
1. Return |F|.
</div>

Expand Down Expand Up @@ -11808,13 +11808,13 @@ in which case they are exposed on every object that [=implements=] the interface
that is a [=promise type=], then return
[=!=] <a abstract-op>Call</a>({{%Promise.reject%}}, {{%Promise%}}, «|E|»).
1. Otherwise, end these steps and allow the exception to propagate.
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
1. [=Compute the effective overload set=] for [=regular operations=] (if |op| is a regular
operation) or for [=static operations=] (if |op| is a static operation) with [=identifier=]
|id| on |target| and with argument count 0, and let |S| be the result.
1. Let |length| be the length of the shortest argument list in the entries in |S|.
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, |length|).
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionLength$](|F|, |length|).
1. Perform [=!=] [$SetFunctionName$](|F|, |id|).
1. Return |F|.
</div>

Expand Down Expand Up @@ -12177,8 +12177,8 @@ property is the String value "<code>forEach</code>".
as its [=default iterator object/kind=], and [=default iterator object/index=]
set to 0.
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1. Perform [=!=] [$CreateMethodProperty$](|target|, {{@@iterator}}, |F|).
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>entries</code>", |F|).
1. Define the <code class="idl">keys</code> method:
Expand All @@ -12192,8 +12192,8 @@ property is the String value "<code>forEach</code>".
|esValue| as its [=default iterator object/target=], "<code>key</code>" as its
[=default iterator object/kind=], and [=default iterator object/index=] set to 0.
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>keys</code>", |F|).
1. Define the <code class="idl">values</code> method:
1. Let |steps| be the following series of steps:
Expand All @@ -12206,8 +12206,8 @@ property is the String value "<code>forEach</code>".
|esValue| as its [=default iterator object/target=], "<code>value</code>" as its
[=default iterator object/kind=], and [=default iterator object/index=] set to 0.
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>values</code>", |F|).
1. Define the <code class="idl">forEach</code> method:
1. Let |steps| be the following series of steps, given function argument values
Expand All @@ -12232,8 +12232,8 @@ property is the String value "<code>forEach</code>".
[=value pairs to iterate over=]. (It might have changed.)
1. Set |i| to |i| + 1.
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>forEach</code>").
1. Perform [=!=] [$SetFunctionLength$](|F|, 1).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>forEach</code>").
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>forEach</code>", |F|).
</div>

Expand Down Expand Up @@ -12368,8 +12368,8 @@ and the string "<code> Iterator</code>".
|idlObject|, |iterator|, and |idlArgs|, if any such steps exist.
1. Return |iterator|.
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1. Perform [=!=] [$CreateMethodProperty$](|target|, {{@@asyncIterator}}, |F|).
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>entries</code>", |F|).
1. If |definition| has a [=pair asynchronously iterable declaration=], then define the
Expand All @@ -12393,8 +12393,8 @@ and the string "<code> Iterator</code>".
|idlObject|, |iterator|, and |idlArgs|, if any such steps exist.
1. Return |iterator|.
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>keys</code>", |F|).
1. Define the <code class="idl">values</code>, and possibly {{@@asyncIterator}}, methods:
1. Let |steps| be the following series of steps, given function argument values |args|:
Expand All @@ -12416,8 +12416,8 @@ and the string "<code> Iterator</code>".
|idlObject|, |iterator|, and |idlArgs|, if any such steps exist.
1. Return |iterator|.
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>values</code>", |F|).
1. If |definition| has a [=value asynchronously iterable declaration=], then perform [=!=]
[$CreateMethodProperty$](|target|, {{@@asyncIterator}}, |F|).
Expand Down Expand Up @@ -13952,9 +13952,9 @@ when applied to a [=legacy callback interface object=].

1. Let |steps| be the following steps:
1. [=ECMAScript/Throw=] a {{ECMAScript/TypeError}}.
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, 0).
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
1. Perform [=!=] [$SetFunctionName$](|F|, |id|).
1. [=Define the constants=] of |interface| on |F| given |realm|.
1. Return |F|.
</div>
Expand Down

0 comments on commit 717ffdb

Please sign in to comment.