Skip to content
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

Merged
merged 3 commits into from Apr 1, 2021

Conversation

caridy
Copy link
Collaborator

@caridy caridy commented Mar 31, 2021

No description provided.

@caridy caridy requested a review from littledan March 31, 2021 19:39
spec.html Show resolved Hide resolved
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%"*]].
Copy link
Collaborator Author

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Collaborator Author

@caridy caridy Apr 3, 2021

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.
@leobalter leobalter merged commit 298bafd into main Apr 1, 2021
@caridy caridy deleted the spec-fix-1 branch April 3, 2021 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants