New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using the proper notation to use intrinsic from another realm #296
Conversation
Co-authored-by: Jordan Harband <ljharb@gmail.com>
spec.html
Outdated
@@ -116,7 +116,7 @@ <h1>WrappedFunctionCreate ( _callerRealm_, _targetFunction_ )</h1> | |||
1. Assert: IsCallable(_targetFunction_) is *true*. | |||
1. Let _internalSlotsList_ be the internal slots listed in <emu-xref href="#table-internal-slots-of-wrapped-function-exotic-objects"></emu-xref>, plus [[Prototype]] and [[Extensible]]. | |||
1. Let _obj_ be ! MakeBasicObject(_internalSlotsList_). | |||
1. Set _obj_.[[Prototype]] to %Function.prototype% from _callerRealm_. | |||
1. Set _obj_.[[Prototype]] to _callerRealm_.[[Intrinsics]].[[*"%Function.prototype%"*]]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leobalter I don't think that's how 262 does it today, not need to use quotes or *
, see AddRestrictedFunctionProperties
algo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct. I'll roll it back and merge as the original.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, that seems like an oversight to me. i'll pursue updating it in 262.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually hm, i can see the logic here. since .[[foo]]
is the string "foo" already, then .[[%Function.prototype%]]
is the string "%Function.prototype%". thanks for finding that use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ljharb fyi, this syntax is used in 262 in a couple of places, see the following example:
<emu-clause id="sec-addrestrictedfunctionproperties" aoid="AddRestrictedFunctionProperties">
<h1>AddRestrictedFunctionProperties ( _F_, _realm_ )</h1>
<p>The abstract operation AddRestrictedFunctionProperties takes arguments _F_ (a function object) and _realm_ (a Realm Record). It performs the following steps when called:</p>
<emu-alg>
1. Assert: _realm_.[[Intrinsics]].[[%ThrowTypeError%]] exists and has been initialized.
This reverts commit 5f08771.
No description provided.