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

Address review feedback #306

Merged
merged 9 commits into from
May 17, 2021
20 changes: 11 additions & 9 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ <h1>Wrapped Function Exotic Objects</h1>
Callable Object
</td>
<td>
The wrapped function object.
Stores the callable object from the other Realm.
</td>
</tr>
<tr>
<td>
[[Realm]]
[[Call]]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added [[Call]] to the table to acknowledge the different behavior

</td>
<td>
Realm Record
The [[Call]] internal method
</td>
<td>
The realm in which the wrapped function object was created.
Executes code associated with this object's [[WrappedTargetFunction]].
</td>
</tr>
</tbody>
Expand All @@ -98,7 +98,7 @@ <h1>[[Call]] ( _thisArgument_, _argumentsList_ )</h1>
1. Let _wrappedThisArgument_ to ? GetWrappedValue(_targetRealm_, _thisArgument_).
1. Let _result_ be the Completion Record of Call(_target_, _wrappedThisArgument_, _argumentsList_).
1. If _result_.[[Type]] is ~normal~ or _result_.[[Type]] is ~return~, then
1. Set _value_ to NormalCompletion(_result_.[[Value]]).
1. Set _value_ to _result_.[[Value]].
leobalter marked this conversation as resolved.
Show resolved Hide resolved
1. Return ? GetWrappedValue(_callerRealm_, _value_).
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value disappears, I need to send _result_ here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1. Else,
1. Throw a newly created TypeError object associate to the _callerRealm_.
Expand All @@ -118,7 +118,6 @@ <h1>WrappedFunctionCreate ( _callerRealm_, _targetFunction_ )</h1>
1. Let _obj_ be ! MakeBasicObject(_internalSlotsList_).
1. Set _obj_.[[Prototype]] to _callerRealm_.[[Intrinsics]].[[%Function.prototype%]].
1. Set _obj_.[[Call]] as described in <emu-xref href="#sec-wrapped-function-exotic-objects-call-thisargument-argumentslist"></emu-xref>.
1. Set _obj_.[[Realm]] to _callerRealm_.
1. Set _obj_.[[WrappedTargetFunction]] to _targetFunction_.
1. Return _obj_.
</emu-alg>
Expand Down Expand Up @@ -172,10 +171,13 @@ <h1>PerformRealmEval ( _sourceText_, _callerRealm_, _evalRealm_ )</h1>
<emu-note type=editor>
In the case of an abrupt ~throw~ completion, the type of error to be created should match the type of the abrupt throw completion record. This could be revisited when merging into the main specification. Additionally, in the case of a ~break~ or ~continue~ completion, since those are not supported, a TypeError is expected. There should be no ~return~ completion because this is a top level script evaluation, in which case a return |Statement| must result in a parsing error.
</emu-note>
<emu-note type=editor>
Some thes PerformRealmEval steps are shared with |eval| and |Function| and should result into a shared abstraction when merged to ECMA-262.
</emu-note>
</emu-clause>

<emu-clause id="sec-performrealmimportvalue" aoid="PerformRealmImportValue">
<h1>PerformRealmImportValue ( _specifierString_, _exportNameString_, _callerRealm_, _evalRealm_, _evalContext_ )</h1>
<emu-clause id="sec-realmimportvalue" aoid="RealmImportValue">
<h1>RealmImportValue ( _specifierString_, _exportNameString_, _callerRealm_, _evalRealm_, _evalContext_ )</h1>
<emu-alg>
1. Assert: Type(_specifierString_) is String.
1. Assert: Type(_exportNameString_) is String.
Expand Down Expand Up @@ -295,7 +297,7 @@ <h1>Realm.prototype.importValue ( _specifier_, _exportName_ )</h1>
1. Let _callerRealm_ be the current Realm Record.
1. Let _evalRealm_ be _O_.[[Realm]].
1. Let _evalContext_ be _O_.[[ExecutionContext]].
1. Return ? PerformRealmImportValue(_specifierString_, _exportNameString_, _callerRealm_, _evalRealm_, _evalContext_).
1. Return ? RealmImportValue(_specifierString_, _exportNameString_, _callerRealm_, _evalRealm_, _evalContext_).
</emu-alg>

<emu-note>
Expand Down