Skip to content

Commit 8868b8a

Browse files
committed
Normative: Match ECMA‑262 function property enumeration order
1 parent 67bc60f commit 8868b8a

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

index.bs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11262,8 +11262,16 @@ default interfaces do not have such steps.
1126211262
1. Let |constructorProto| be |realm|.\[[Intrinsics]].[[{{%Function.prototype%}}]].
1126311263
1. If |I| inherits from some other interface |P|,
1126411264
then set |constructorProto| to the [=interface object=] of |P| in |realm|.
11265-
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « \[[Unforgeables]] »,
11265+
1. Let |length| be 0.
11266+
1. If |I| was declared with a [=constructor operation=], then
11267+
1. [=Compute the effective overload set=] for constructors with [=identifier=] |id| on
11268+
[=interface=] |I| and with argument count 0, and let |S| be the result.
11269+
1. Set |length| to the length of the
11270+
shortest argument list of the entries in |S|.
11271+
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « \[[Unforgeables]] »,
1126611272
|realm|, |constructorProto|).
11273+
1. Perform [=!=] [$SetFunctionLength$](|F|, |length|).
11274+
1. Perform [=!=] [$SetFunctionName$](|F|, |id|).
1126711275
1. Let |unforgeables| be [=!=] [$OrdinaryObjectCreate$](<emu-val>null</emu-val>).
1126811276
1. [=Define the unforgeable regular operations=] of |I| on |unforgeables|, given |realm|.
1126911277
1. [=Define the unforgeable regular attributes=] of |I| on |unforgeables|, given |realm|.
@@ -11273,14 +11281,6 @@ default interfaces do not have such steps.
1127311281
of an interface with an unforgeable member use the same JavaScript function objects for
1127411282
[=attribute getters=], [=attribute setters=] and [=creating an operation
1127511283
function|operation functions=].
11276-
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
11277-
1. Let |length| be 0.
11278-
1. If |I| was declared with a [=constructor operation=], then
11279-
1. [=Compute the effective overload set=] for constructors with [=identifier=] |id| on
11280-
[=interface=] |I| and with argument count 0, and let |S| be the result.
11281-
1. Set |length| to the length of the
11282-
shortest argument list of the entries in |S|.
11283-
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, |length|).
1128411284
1. Let |proto| be the result of [=create an interface prototype object|creating an interface
1128511285
prototype object=] of [=interface=] |I| in |realm|.
1128611286
1. Perform [=!=] <a abstract-op>DefinePropertyOrThrow</a>(|F|, "<code>prototype</code>",
@@ -11326,12 +11326,12 @@ implement the interface on which the
1132611326
1. Assert: |O| is an object that [=implements=] |I|.
1132711327
1. Assert: |O|.\[[Realm]] is |realm|.
1132811328
1. Return |O|.
11329-
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
11330-
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |id|).
1133111329
1. [=Compute the effective overload set=] for legacy factory functions with [=identifier=] |id|
1133211330
on [=interface=] |I| and with argument count 0, and let |S| be the result.
1133311331
1. Let |length| be the length of the shortest argument list of the entries in |S|.
11334-
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, |length|).
11332+
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
11333+
1. Perform [=!=] [$SetFunctionLength$](|F|, |length|).
11334+
1. Perform [=!=] [$SetFunctionName$](|F|, |id|).
1133511335
1. Let |proto| be the [=interface prototype object=] of [=interface=] |I| in |realm|.
1133611336
1. Perform [=!=] <a abstract-op>DefinePropertyOrThrow</a>(|F|, "<code>prototype</code>",
1133711337
PropertyDescriptor{\[[Value]]: |proto|, \[[Writable]]: <emu-val>false</emu-val>, \[[Enumerable]]: <emu-val>false</emu-val>, \[[Configurable]]: <emu-val>false</emu-val>}).
@@ -11680,10 +11680,10 @@ in which case they are exposed on every object that [=implements=] the interface
1168011680
1. If |attribute|'s type is a [=promise type=], then return
1168111681
[=!=] <a abstract-op>Call</a>({{%Promise.reject%}}, {{%Promise%}}, «|E|»).
1168211682
1. Otherwise, end these steps and allow the exception to propagate.
11683-
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
11684-
1. Let |name| be the string "<code>get </code>" prepended to |attribute|'s [=identifier=].
11685-
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |name|).
11686-
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, 0).
11683+
1. Let |name| be |attribute|'s [=identifier=].
11684+
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
11685+
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
11686+
1. Perform [=!=] [$SetFunctionName$](|F|, |name|, "<code>get</code>").
1168711687
1. Return |F|.
1168811688

1168911689
</div>
@@ -11766,10 +11766,10 @@ in which case they are exposed on every object that [=implements=] the interface
1176611766
1. Perform the [=setter steps=] of |attribute|,
1176711767
with |idlObject| as [=this=] and |idlValue| as [=the given value=].
1176811768
1. Return <emu-val>undefined</emu-val>
11769-
1. Let |F| be [=!=] <a abstract-op>CreateBuiltinFunction</a>(|steps|, « », |realm|).
11770-
1. Let |name| be the string "<code>set </code>" prepended to |id|.
11771-
1. Perform [=!=] <a abstract-op>SetFunctionName</a>(|F|, |name|).
11772-
1. Perform [=!=] <a abstract-op>SetFunctionLength</a>(|F|, 1).
11769+
1. Let |name| be |attribute|'s [=identifier=].
11770+
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
11771+
1. Perform [=!=] [$SetFunctionLength$](|F|, 1).
11772+
1. Perform [=!=] [$SetFunctionName$](|F|, |name|, "<code>set</code>").
1177311773
1. Return |F|.
1177411774
</div>
1177511775

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

@@ -12253,8 +12253,8 @@ property is the String value "<code>forEach</code>".
1225312253
as its [=default iterator object/kind=], and [=default iterator object/index=]
1225412254
set to 0.
1225512255
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12256-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1225712256
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12257+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1225812258
1. Perform [=!=] [$CreateMethodProperty$](|target|, {{@@iterator}}, |F|).
1225912259
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>entries</code>", |F|).
1226012260
1. Define the <code class="idl">keys</code> method:
@@ -12268,8 +12268,8 @@ property is the String value "<code>forEach</code>".
1226812268
|esValue| as its [=default iterator object/target=], "<code>key</code>" as its
1226912269
[=default iterator object/kind=], and [=default iterator object/index=] set to 0.
1227012270
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12271-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1227212271
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12272+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1227312273
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>keys</code>", |F|).
1227412274
1. Define the <code class="idl">values</code> method:
1227512275
1. Let |steps| be the following series of steps:
@@ -12282,8 +12282,8 @@ property is the String value "<code>forEach</code>".
1228212282
|esValue| as its [=default iterator object/target=], "<code>value</code>" as its
1228312283
[=default iterator object/kind=], and [=default iterator object/index=] set to 0.
1228412284
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12285-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1228612285
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12286+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1228712287
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>values</code>", |F|).
1228812288
1. Define the <code class="idl">forEach</code> method:
1228912289
1. Let |steps| be the following series of steps, given function argument values
@@ -12308,8 +12308,8 @@ property is the String value "<code>forEach</code>".
1230812308
[=value pairs to iterate over=]. (It might have changed.)
1230912309
1. Set |i| to |i| + 1.
1231012310
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12311-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>forEach</code>").
1231212311
1. Perform [=!=] [$SetFunctionLength$](|F|, 1).
12312+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>forEach</code>").
1231312313
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>forEach</code>", |F|).
1231412314
</div>
1231512315

@@ -12444,8 +12444,8 @@ and the string "<code> Iterator</code>".
1244412444
|idlObject|, |iterator|, and |idlArgs|, if any such steps exist.
1244512445
1. Return |iterator|.
1244612446
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12447-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1244812447
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12448+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>entries</code>").
1244912449
1. Perform [=!=] [$CreateMethodProperty$](|target|, {{@@asyncIterator}}, |F|).
1245012450
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>entries</code>", |F|).
1245112451
1. If |definition| has a [=pair asynchronously iterable declaration=], then define the
@@ -12469,8 +12469,8 @@ and the string "<code> Iterator</code>".
1246912469
|idlObject|, |iterator|, and |idlArgs|, if any such steps exist.
1247012470
1. Return |iterator|.
1247112471
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12472-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1247312472
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12473+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>keys</code>").
1247412474
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>keys</code>", |F|).
1247512475
1. Define the <code class="idl">values</code>, and possibly {{@@asyncIterator}}, methods:
1247612476
1. Let |steps| be the following series of steps, given function argument values |args|:
@@ -12492,8 +12492,8 @@ and the string "<code> Iterator</code>".
1249212492
|idlObject|, |iterator|, and |idlArgs|, if any such steps exist.
1249312493
1. Return |iterator|.
1249412494
1. Let |F| be [=!=] [$CreateBuiltinFunction$](|steps|, « », |realm|).
12495-
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1249612495
1. Perform [=!=] [$SetFunctionLength$](|F|, 0).
12496+
1. Perform [=!=] [$SetFunctionName$](|F|, "<code>values</code>").
1249712497
1. Perform [=!=] [$CreateDataProperty$](|target|, "<code>values</code>", |F|).
1249812498
1. If |definition| has a [=value asynchronously iterable declaration=], then perform [=!=]
1249912499
[$CreateMethodProperty$](|target|, {{@@asyncIterator}}, |F|).
@@ -14028,9 +14028,9 @@ when applied to a [=legacy callback interface object=].
1402814028

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

0 commit comments

Comments
 (0)