archives

« Bugzilla Issues Index

#2813 — 9.2.8: redundant code?


In 9.2.8 "AddRestrictedFunctionProperties Abstract Operation",
steps 1 and 2 say:
1. If SameValue(F, %ThrowTypeError%) is true, then let thrower be F.
2. Else, let thrower be the %ThrowTypeError% intrinsic function Object.

It seems like the net effect of the two branches are the same, so why distinguish them?


fixed in rev25 editor's draft

this was a failed attempt to deal with initialization sequencing issues that arise from the fact that %ThrowTypeError%% is itself a built-in function that needs to have the restricted properties (which use %ThrowTypeError%)

Fixed, in a more complex and hopefully correct manner as part of Realm initialization.


Ah, I see. In that case, I suggest:

(a) In 8.2.2 CreateIntrinsics, replace steps 6-11 with:

Let thrower be CreateBuiltinFunction(realmRec, throwerSteps, undefined).
Assert: thrower is not an abrupt completion.

(b) Here in 9.2.8, replace step 1 with:

If realm.[[intrinsics]].[[%ThrowTypeError%]] exists,
Let thrower be realm.[[intrinsics]].[[%ThrowTypeError%]]
Else,
Note: realm.[[intrinsics]] is in the process of being constructed
(by CreateIntrinsics), and F is the function that will be
assigned to realm.[[intrinsics]].[[%ThrowTypeError%]]
Let thrower be F.

(In any event, in 9.2.8 / step 1, change "realmRec" to "realm".)


fixed in rev26 editor's draft


in rev26 draft