Skip to content

Commit 717ffdb

Browse files
committed
Normative: Match ECMA‑262 function property enumeration order
1 parent 02abd62 commit 717ffdb

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

index.bs

+31-31
Original file line numberDiff line numberDiff line change
@@ -11186,8 +11186,16 @@ default interfaces do not have such steps.
1118611186
1. Let |constructorProto| be |realm|.\[[Intrinsics]].[[{{%Function.prototype%}}]].
1118711187
1. If |I| inherits from some other interface |P|,
1118811188
then set |constructorProto| to the [=interface object=] of |P| in |realm|.
11189-
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « \[[Unforgeables]] »,
11189+
1. Let |length| be 0.
11190+
1. If |I| was declared with a [=constructor operation=], then
11191+
1. [=Compute the effective overload set=] for constructors with [=identifier=] |id| on
11192+
[=interface=] |I| and with argument count 0, and let |S| be the result.
11193+
1. Set |length| to the length of the
11194+
shortest argument list of the entries in |S|.
11195+
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « \[[Unforgeables]] »,
1119011196
|realm|, |constructorProto|).
11197+
1. Perform [=!=] [$SetFunctionLength$](|F|, |length|).
11198+
1. Perform [=!=] [$SetFunctionName$](|F|, |id|).
1119111199
1. Let |unforgeables| be [=!=] [$OrdinaryObjectCreate$](<emu-val>null</emu-val>).
1119211200
1. [=Define the unforgeable regular operations=] of |I| on |unforgeables|, given |realm|.
1119311201
1. [=Define the unforgeable regular attributes=] of |I| on |unforgeables|, given |realm|.
@@ -11197,14 +11205,6 @@ default interfaces do not have such steps.
1119711205
of an interface with an unforgeable member use the same JavaScript function objects for
1119811206
[=attribute getters=], [=attribute setters=] and [=creating an operation
1119911207
function|operation functions=].
11200-
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
11201-
1. Let |length| be 0.
11202-
1. If |I| was declared with a [=constructor operation=], then
11203-
1. [=Compute the effective overload set=] for constructors with [=identifier=] |id| on
11204-
[=interface=] |I| and with argument count 0, and let |S| be the result.
11205-
1. Set |length| to the length of the
11206-
shortest argument list of the entries in |S|.
11207-
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, |length|).
1120811208
1. Let |proto| be the result of [=create an interface prototype object|creating an interface
1120911209
prototype object=] of [=interface=] |I| in |realm|.
1121011210
1. Perform [=!=] <a abstract-op>DefinePropertyOrThrow</a>(|F|, "<code>prototype</code>",
@@ -11250,12 +11250,12 @@ implement the interface on which the
1125011250
1. Assert: |O| is an object that [=implements=] |I|.
1125111251
1. Assert: |O|.\[[Realm]] is |realm|.
1125211252
1. Return |O|.
11253-
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
11254-
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
1125511253
1. [=Compute the effective overload set=] for legacy factory functions with [=identifier=] |id|
1125611254
on [=interface=] |I| and with argument count 0, and let |S| be the result.
1125711255
1. Let |length| be the length of the shortest argument list of the entries in |S|.
11258-
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, |length|).
11256+
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
11257+
1. Perform [=!=] [$SetFunctionLength$](|F|, |length|).
11258+
1. Perform [=!=] [$SetFunctionName$](|F|, |id|).
1125911259
1. Let |proto| be the [=interface prototype object=] of [=interface=] |I| in |realm|.
1126011260
1. Perform [=!=] <a abstract-op>DefinePropertyOrThrow</a>(|F|, "<code>prototype</code>",
1126111261
PropertyDescriptor{\[[Value]]: |proto|, \[[Writable]]: <emu-val>false</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>false</emu-val>}).
@@ -11604,10 +11604,10 @@ in which case they are exposed on every object that [=implements=] the interface
1160411604
1. If |attribute|'s type is a [=promise type=], then return
1160511605
[=!=] <a abstract-op>Call</a>({{%Promise.reject%}}, {{%Promise%}}, «|E|»).
1160611606
1. Otherwise, end these steps and allow the exception to propagate.
11607-
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
1160811607
1. Let |name| be the string "<code>get </code>" prepended to |attribute|'s [=identifier=].
11609-
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |name|).
11610-
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, 0).
11608+
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
11609+
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
11610+
1. Perform [=!=] [$SetFunctionName$](|F|, |name|).
1161111611
1. Return |F|.
1161211612

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

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

@@ -12177,8 +12177,8 @@ property is the String value "<code>forEach</code>".
1217712177
as its [=default iterator object/kind=], and [=default iterator object/index=]
1217812178
set to 0.
1217912179
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12180-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1218112180
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12181+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1218212182
1. Perform [=!=] [$CreateMethodProperty$](|target|, {{@@iterator}}, |F|).
1218312183
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>entries</code>", |F|).
1218412184
1. Define the <code class="idl">keys</code> method:
@@ -12192,8 +12192,8 @@ property is the String value "<code>forEach</code>".
1219212192
|esValue| as its [=default iterator object/target=], "<code>key</code>" as its
1219312193
[=default iterator object/kind=], and [=default iterator object/index=] set to 0.
1219412194
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12195-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1219612195
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12196+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1219712197
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>keys</code>", |F|).
1219812198
1. Define the <code class="idl">values</code> method:
1219912199
1. Let |steps| be the following series of steps:
@@ -12206,8 +12206,8 @@ property is the String value "<code>forEach</code>".
1220612206
|esValue| as its [=default iterator object/target=], "<code>value</code>" as its
1220712207
[=default iterator object/kind=], and [=default iterator object/index=] set to 0.
1220812208
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12209-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1221012209
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12210+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1221112211
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>values</code>", |F|).
1221212212
1. Define the <code class="idl">forEach</code> method:
1221312213
1. Let |steps| be the following series of steps, given function argument values
@@ -12232,8 +12232,8 @@ property is the String value "<code>forEach</code>".
1223212232
[=value pairs to iterate over=]. (It might have changed.)
1223312233
1. Set |i| to |i| + 1.
1223412234
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12235-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>forEach</code>").
1223612235
1. Perform [=!=] [$SetFunctionLength$](|F|, 1).
12236+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>forEach</code>").
1223712237
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>forEach</code>", |F|).
1223812238
</div>
1223912239

@@ -12368,8 +12368,8 @@ and the string "<code> Iterator</code>".
1236812368
|idlObject|, |iterator|, and |idlArgs|, if any such steps exist.
1236912369
1. Return |iterator|.
1237012370
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12371-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1237212371
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12372+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1237312373
1. Perform [=!=] [$CreateMethodProperty$](|target|, {{@@asyncIterator}}, |F|).
1237412374
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>entries</code>", |F|).
1237512375
1. If |definition| has a [=pair asynchronously iterable declaration=], then define the
@@ -12393,8 +12393,8 @@ and the string "<code> Iterator</code>".
1239312393
|idlObject|, |iterator|, and |idlArgs|, if any such steps exist.
1239412394
1. Return |iterator|.
1239512395
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12396-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1239712396
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12397+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1239812398
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>keys</code>", |F|).
1239912399
1. Define the <code class="idl">values</code>, and possibly {{@@asyncIterator}}, methods:
1240012400
1. Let |steps| be the following series of steps, given function argument values |args|:
@@ -12416,8 +12416,8 @@ and the string "<code> Iterator</code>".
1241612416
|idlObject|, |iterator|, and |idlArgs|, if any such steps exist.
1241712417
1. Return |iterator|.
1241812418
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12419-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1242012419
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12420+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1242112421
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>values</code>", |F|).
1242212422
1. If |definition| has a [=value asynchronously iterable declaration=], then perform [=!=]
1242312423
[$CreateMethodProperty$](|target|, {{@@asyncIterator}}, |F|).
@@ -13952,9 +13952,9 @@ when applied to a [=legacy callback interface object=].
1395213952

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

0 commit comments

Comments
 (0)