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 Nov 1, 2020
1 parent 67bc60f commit 8868b8a
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -11262,8 +11262,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 @@ -11273,14 +11281,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 @@ -11326,12 +11326,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 @@ -11680,10 +11680,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 |name| be |attribute|'s [=identifier=].
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
1. Perform [=!=] [$SetFunctionName$](|F|, |name|, "<code>get</code>").
1. Return |F|.

</div>
Expand Down Expand Up @@ -11766,10 +11766,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 |name| be |attribute|'s [=identifier=].
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
1. Perform [=!=] [$SetFunctionLength$](|F|, 1).
1. Perform [=!=] [$SetFunctionName$](|F|, |name|, "<code>set</code>").
1. Return |F|.
</div>

Expand Down Expand Up @@ -11884,13 +11884,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 @@ -12253,8 +12253,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 @@ -12268,8 +12268,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 @@ -12282,8 +12282,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 @@ -12308,8 +12308,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 @@ -12444,8 +12444,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 @@ -12469,8 +12469,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 @@ -12492,8 +12492,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 @@ -14028,9 +14028,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 8868b8a

Please sign in to comment.