From 087b207b71268eb5e98f53f0a59487629976b84f Mon Sep 17 00:00:00 2001 From: ExE Boss Date: Fri, 3 Sep 2021 15:40:00 +0200 Subject: [PATCH] =?UTF-8?q?Normative:=20Match=C2=A0ECMA=E2=80=91262=20func?= =?UTF-8?q?tion=C2=A0property=20enumeration=C2=A0order?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ms2ger Co-authored-by: Timothy Gu --- index.bs | 107 ++++++++++++++++++++----------------------------------- 1 file changed, 38 insertions(+), 69 deletions(-) diff --git a/index.bs b/index.bs index b2844780..65bcfe81 100644 --- a/index.bs +++ b/index.bs @@ -145,8 +145,6 @@ urlPrefix: https://tc39.es/ecma262/; spec: ECMA-262 text: PerformPromiseThen; url: sec-performpromisethen text: ProxyCreate; url: sec-proxycreate text: Set; url: sec-set-o-p-v-throw - text: SetFunctionLength; url: sec-setfunctionlength - text: SetFunctionName; url: sec-setfunctionname text: SetImmutablePrototype; url: sec-set-immutable-prototype text: SetIntegrityLevel; url: sec-setintegritylevel text: SetValueInBuffer; url: sec-setvalueinbuffer @@ -8372,7 +8370,7 @@ IDL [=promise type=] values are represented by ECMAScript [=PromiseCapability=] the result of performing them, given |value| if |T| is not {{undefined}}. Otherwise, let |result| be |value|. 1. Return |result|, [=converted to an ECMAScript value=]. - 1. Let |onFulfilled| be [$CreateBuiltinFunction$](|onFulfilledSteps|, « »): + 1. Let |onFulfilled| be [$CreateBuiltinFunction$](|onFulfilledSteps|, 1, "", « »): 1. Let |onRejectedSteps| be the following steps given argument |R|: 1. Let |reason| be the result of [=converted to an IDL value|converting=] |R| to an IDL value of type {{any}}. @@ -8380,7 +8378,7 @@ IDL [=promise type=] values are represented by ECMAScript [=PromiseCapability=] the result of performing them, given |reason|. Otherwise, let |result| be [=a promise rejected with=] |reason|. 1. Return |result|, [=converted to an ECMAScript value=]. - 1. Let |onRejected| be [$CreateBuiltinFunction$](|onRejectedSteps|, « »): + 1. Let |onRejected| be [$CreateBuiltinFunction$](|onRejectedSteps|, 1, "", « »): 1. Let |constructor| be |promise|.\[[Promise]].\[[Realm]].\[[Intrinsics]].[[{{%Promise%}}]]. 1. Let |newCapability| be [=?=] [$NewPromiseCapability$](|constructor|). @@ -8431,7 +8429,7 @@ IDL [=promise type=] values are represented by ECMAScript [=PromiseCapability=] 1. If |rejected| is true, abort these steps. 1. Set |rejected| to true. 1. Perform |failureSteps| given |arg|. - 1. Let |rejectionHandler| be [$CreateBuiltinFunction$](|rejectionHandlerSteps|, « »): + 1. Let |rejectionHandler| be [$CreateBuiltinFunction$](|rejectionHandlerSteps|, 1, "", « »): 1. Let |total| be |promises|'s [=list/size=]. 1. If |total| is 0, then: 1. [=Queue a microtask=] to perform |successSteps| given « ». @@ -8444,7 +8442,7 @@ IDL [=promise type=] values are represented by ECMAScript [=PromiseCapability=] 1. Set |result|[|promiseIndex|] to |arg|. 1. Set |fullfilledCount| to |fullfilledCount| + 1. 1. If |fullfilledCount| equals |total|, then perform |successSteps| given |result|. - 1. Let |fulfillmentHandler| be [$CreateBuiltinFunction$](|fulfillmentHandler|, « »): + 1. Let |fulfillmentHandler| be [$CreateBuiltinFunction$](|fulfillmentHandler|, 1, "", « »): 1. Perform [$PerformPromiseThen$](|promise|, |fulfillmentHandler|, |rejectionHandler|). 1. Set |index| to |index| + 1. @@ -11490,7 +11488,13 @@ 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 CreateBuiltinFunction(|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|, |length|, |id|, « \[[Unforgeables]] », |realm|, |constructorProto|). 1. Let |unforgeables| be [$OrdinaryObjectCreate$](null). 1. [=Define the unforgeable regular operations=] of |I| on |unforgeables|, given |realm|. @@ -11501,14 +11505,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 SetFunctionName(|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 SetFunctionLength(|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 [=!=] DefinePropertyOrThrow(|F|, "prototype", @@ -11554,12 +11550,10 @@ 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 CreateBuiltinFunction(|steps|, « », |realm|). - 1. Perform SetFunctionName(|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 SetFunctionLength(|F|, |length|). + 1. Let |F| be [$CreateBuiltinFunction$](|steps|, |length|, |id|, « », |realm|). 1. Let |proto| be the [=interface prototype object=] of [=interface=] |I| in |realm|. 1. Perform [=!=] DefinePropertyOrThrow(|F|, "prototype", PropertyDescriptor{\[[Value]]: |proto|, \[[Writable]]: false, \[[Enumerable]]: false, \[[Configurable]]: false}). @@ -11908,11 +11902,8 @@ in which case they are exposed on every object that [=implements=] the interface 1. If |attribute|'s type is a [=promise type=], then return [=!=] Call({{%Promise.reject%}}, {{%Promise%}}, «|E|»). 1. Otherwise, end these steps and allow the exception to propagate. - 1. Let |F| be CreateBuiltinFunction(|steps|, « », |realm|). - 1. Let |name| be the string "get " prepended to |attribute|'s [=identifier=]. - 1. Perform SetFunctionName(|F|, |name|). - 1. Perform SetFunctionLength(|F|, 0). - 1. Return |F|. + 1. Let |name| be |attribute|'s [=identifier=]. + 1. Return [$CreateBuiltinFunction$](|steps|, 0, |name|, « », |realm|, |realm|.\[[Intrinsics]].\[[{{%Function.prototype%}}]], "get"). @@ -11994,11 +11985,8 @@ 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 undefined - 1. Let |F| be CreateBuiltinFunction(|steps|, « », |realm|). - 1. Let |name| be the string "set " prepended to |id|. - 1. Perform SetFunctionName(|F|, |name|). - 1. Perform SetFunctionLength(|F|, 1). - 1. Return |F|. + 1. Let |name| be |attribute|'s [=identifier=]. + 1. Return be [$CreateBuiltinFunction$](|steps|, 1, |name|, « », |realm|, |realm|.\[[Intrinsics]].\[[{{%Function.prototype%}}]], "set"). Note: Although there is only a single property for an IDL attribute, since @@ -12112,14 +12100,11 @@ in which case they are exposed on every object that [=implements=] the interface that is a [=promise type=], then return [=!=] Call({{%Promise.reject%}}, {{%Promise%}}, «|E|»). 1. Otherwise, end these steps and allow the exception to propagate. - 1. Let |F| be CreateBuiltinFunction(|steps|, « », |realm|). - 1. Perform SetFunctionName(|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 SetFunctionLength(|F|, |length|). - 1. Return |F|. + 1. Return [$CreateBuiltinFunction$](|steps|, |length|, |id|, « », |realm|). @@ -12469,9 +12454,7 @@ property is the String value "forEach". |esValue| as its [=default iterator object/target=], "key+value" 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|, "entries"). - 1. Perform [$SetFunctionLength$](|F|, 0). + 1. Let |F| be [$CreateBuiltinFunction$](|steps|, 0, "entries", « », |realm|). 1. Perform [$CreateMethodProperty$](|target|, {{@@iterator}}, |F|). 1. Perform [=!=] [$CreateDataProperty$](|target|, "entries", |F|). 1. Define the keys method: @@ -12484,9 +12467,7 @@ property is the String value "forEach". 1. Return a newly created [=default iterator object=] for |definition|, with |esValue| as its [=default iterator object/target=], "key" 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|, "keys"). - 1. Perform [$SetFunctionLength$](|F|, 0). + 1. Let |F| be [$CreateBuiltinFunction$](|steps|, 0, "keys", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|target|, "keys", |F|). 1. Define the values method: 1. Let |steps| be the following series of steps: @@ -12498,9 +12479,7 @@ property is the String value "forEach". 1. Return a newly created [=default iterator object=] for |definition|, with |esValue| as its [=default iterator object/target=], "value" 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|, "values"). - 1. Perform [$SetFunctionLength$](|F|, 0). + 1. Let |F| be [$CreateBuiltinFunction$](|steps|, 0, "values", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|target|, "values", |F|). 1. Define the forEach method: 1. Let |steps| be the following series of steps, given function argument values @@ -12524,9 +12503,7 @@ property is the String value "forEach". 1. Set |pairs| to |idlObject|'s current list of [=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|, "forEach"). - 1. Perform [$SetFunctionLength$](|F|, 1). + 1. Let |F| be [$CreateBuiltinFunction$](|steps|, 1, "forEach", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|target|, "forEach", |F|). @@ -12661,9 +12638,7 @@ and the string " Iterator". 1. Run the [=asynchronous iterator initialization steps=] for |definition| with |idlObject|, |iterator|, and |idlArgs|, if any such steps exist. 1. Return |iterator|. - 1. Let |F| be [$CreateBuiltinFunction$](|steps|, « », |realm|). - 1. Perform [$SetFunctionName$](|F|, "entries"). - 1. Perform [$SetFunctionLength$](|F|, 0). + 1. Let |F| be [$CreateBuiltinFunction$](|steps|, 0, "entries", « », |realm|). 1. Perform [$CreateMethodProperty$](|target|, {{@@asyncIterator}}, |F|). 1. Perform [=!=] [$CreateDataProperty$](|target|, "entries", |F|). 1. If |definition| has a [=pair asynchronously iterable declaration=], then define the @@ -12686,9 +12661,7 @@ and the string " Iterator". 1. Run the [=asynchronous iterator initialization steps=] for |definition| with |idlObject|, |iterator|, and |idlArgs|, if any such steps exist. 1. Return |iterator|. - 1. Let |F| be [$CreateBuiltinFunction$](|steps|, « », |realm|). - 1. Perform [$SetFunctionName$](|F|, "keys"). - 1. Perform [$SetFunctionLength$](|F|, 0). + 1. Let |F| be [$CreateBuiltinFunction$](|steps|, 0, "keys", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|target|, "keys", |F|). 1. Define the values, and possibly {{@@asyncIterator}}, methods: 1. Let |steps| be the following series of steps, given function argument values |args|: @@ -12709,9 +12682,7 @@ and the string " Iterator". 1. Run the [=asynchronous iterator initialization steps=] for |definition| with |idlObject|, |iterator|, and |idlArgs|, if any such steps exist. 1. Return |iterator|. - 1. Let |F| be [$CreateBuiltinFunction$](|steps|, « », |realm|). - 1. Perform [$SetFunctionName$](|F|, "values"). - 1. Perform [$SetFunctionLength$](|F|, 0). + 1. Let |F| be [$CreateBuiltinFunction$](|steps|, 0, "values", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|target|, "values", |F|). 1. If |definition| has a [=value asynchronously iterable declaration=], then perform [=!=] [$CreateMethodProperty$](|target|, {{@@asyncIterator}}, |F|). @@ -12837,13 +12808,13 @@ The \[[Prototype]] [=internal slot=] of an [=asynchronous iterator prototype obj 1. Assert: |next| is a value of the type that appears in the declaration. 1. Let |value| be |next|, [=converted to an ECMAScript value=]. 1. Return [$CreateIterResultObject$](|value|, false). - 1. Let |onFulfilled| be [$CreateBuiltinFunction$](|fulfillSteps|, « »). + 1. Let |onFulfilled| be [$CreateBuiltinFunction$](|fulfillSteps|, 1, "", « »). 1. Let |rejectSteps| be the following steps, given |reason|: 1. Set |object|'s [=default asynchronous iterator object/ongoing promise=] to null. 1. Set |object|'s [=default asynchronous iterator object/is finished=] to true. 1. [=ECMAScript/Throw=] |reason|. - 1. Let |onRejected| be [$CreateBuiltinFunction$](|rejectSteps|, « »). + 1. Let |onRejected| be [$CreateBuiltinFunction$](|rejectSteps|, 1, "", « »). 1. Perform [$PerformPromiseThen$](|nextPromise|, |onFulfilled|, |onRejected|, |nextPromiseCapability|). 1. Return |nextPromiseCapability|.\[[Promise]]. @@ -12852,7 +12823,7 @@ The \[[Prototype]] [=internal slot=] of an [=asynchronous iterator prototype obj 1. If |ongoingPromise| is not null, then: 1. Let |afterOngoingPromiseCapability| be [=!=] [$NewPromiseCapability$]({{%Promise%}}). - 1. Let |onSettled| be [$CreateBuiltinFunction$](|nextSteps|, « »). + 1. Let |onSettled| be [$CreateBuiltinFunction$](|nextSteps|, 0, "", « »). 1. Perform [$PerformPromiseThen$](|ongoingPromise|, |onSettled|, |onSettled|, |afterOngoingPromiseCapability|). 1. Set |object|'s [=default asynchronous iterator object/ongoing promise=] to @@ -12918,7 +12889,7 @@ The \[[Prototype]] [=internal slot=] of an [=asynchronous iterator prototype obj 1. If |ongoingPromise| is not null, then: 1. Let |afterOngoingPromiseCapability| be [=!=] [$NewPromiseCapability$]({{%Promise%}}). - 1. Let |onSettled| be [$CreateBuiltinFunction$](|returnSteps|, « »). + 1. Let |onSettled| be [$CreateBuiltinFunction$](|returnSteps|, 0, "", « »). 1. Perform [$PerformPromiseThen$](|ongoingPromise|, |onSettled|, |onSettled|, |afterOngoingPromiseCapability|). 1. Set |returnStepsPromise| to |afterOngoingPromiseCapability|.\[[Promise]]. @@ -12929,7 +12900,7 @@ The \[[Prototype]] [=internal slot=] of an [=asynchronous iterator prototype obj 1. Let |fulfillSteps| be the following steps: 1. Return [$CreateIterResultObject$](|value|, true). - 1. Let |onFulfilled| be [$CreateBuiltinFunction$](|fulfillSteps|, « »). + 1. Let |onFulfilled| be [$CreateBuiltinFunction$](|fulfillSteps|, 0, "", « »). 1. Perform [$PerformPromiseThen$](|returnStepsPromise|, |onFulfilled|, undefined, |returnPromiseCapability|). @@ -13910,21 +13881,21 @@ those of normal Array instances: 1. Set |handler|.\[[Type]] to |T|. 1. Set |handler|.\[[SetAlgorithm]] to |setAlgorithm|. 1. Set |handler|.\[[DeleteAlgorithm]] to |deleteAlgorithm|. - 1. Let |defineProperty| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-defineProperty]], « », |realm|). + 1. Let |defineProperty| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-defineProperty]], the number of non-optional parameters from [[#es-observable-array-defineProperty]], "defineProperty", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|handler|, "defineProperty", |defineProperty|). - 1. Let |deleteProperty| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-deleteProperty]], « », |realm|). + 1. Let |deleteProperty| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-deleteProperty]], the number of non-optional parameters from [[#es-observable-array-deleteProperty]], "deleteProperty", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|handler|, "deleteProperty", |deleteProperty|). - 1. Let |get| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-get]], « », |realm|). + 1. Let |get| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-get]], the number of non-optional parameters from [[#es-observable-array-get]], "get", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|handler|, "get", |get|). - 1. Let |getOwnPropertyDescriptor| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-getOwnPropertyDescriptor]], « », |realm|). + 1. Let |getOwnPropertyDescriptor| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-getOwnPropertyDescriptor]], the number of non-optional parameters from [[#es-observable-array-getOwnPropertyDescriptor]], "getOwnPropertyDescriptor", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|handler|, "getOwnPropertyDescriptor", |getOwnPropertyDescriptor|). - 1. Let |has| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-has]], « », |realm|). + 1. Let |has| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-has]], the number of non-optional parameters from [[#es-observable-array-has]], "has", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|handler|, "has", |has|). - 1. Let |ownKeys| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-ownKeys]], « », |realm|). + 1. Let |ownKeys| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-ownKeys]], the number of non-optional parameters from [[#es-observable-array-ownKeys]], "ownKeys", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|handler|, "ownKeys", |ownKeys|). - 1. Let |preventExtensions| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-preventExtensions]], « », |realm|). + 1. Let |preventExtensions| be [=!=] [$CreateBuiltinFunction$](the steps from [[#es-observable-array-preventExtensions]], the number of non-optional parameters from [[#es-observable-array-preventExtensions]], "preventExtensions", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|handler|, "preventExtensions", |preventExtensions|). - 1. Let |set| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-set]], « », |realm|). + 1. Let |set| be [$CreateBuiltinFunction$](the steps from [[#es-observable-array-set]], the number of non-optional parameters from [[#es-observable-array-set]], "set", « », |realm|). 1. Perform [=!=] [$CreateDataProperty$](|handler|, "set", |set|). 1. Return [=!=] [$ProxyCreate$](|innerArray|, |handler|). @@ -14247,9 +14218,7 @@ 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 CreateBuiltinFunction(|steps|, « », |realm|). - 1. Perform SetFunctionName(|F|, |id|). - 1. Perform SetFunctionLength(|F|, 0). + 1. Let |F| be [$CreateBuiltinFunction$](|steps|, 0, |id|, « », |realm|). 1. [=Define the constants=] of |interface| on |F| given |realm|. 1. Return |F|.