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

Spec fixes, applies review feedback #309

Merged
merged 4 commits into from
May 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ <h1>[[Call]] ( _thisArgument_, _argumentsList_ )</h1>
1. Assert: IsCallable(_target_) is *true*.
1. Let _targetRealm_ be ? GetFunctionRealm(_target_).
1. Let _callerRealm_ be ? GetFunctionRealm(_F_).
1. For each element _key_ of _argumentsList_, do
1. Let _o_ be _argumentsList_[_key_].
1. Set _argumentsList_[_key_] to ? GetWrappedValue(_targetRealm_, _o_).
1. Let _wrappedArgs_ be a new empty List.
Copy link
Collaborator

Choose a reason for hiding this comment

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

this was me being lazy! jajaja... good catch!

1. For each element _arg_ of _argumentsList_, do
1. Let _wrappedValue_ be ? GetWrappedValue(_targetRealm_, _arg_).
1. Append _wrappedValue_ to _wrappedArgs_.
1. Let _wrappedThisArgument_ to ? GetWrappedValue(_targetRealm_, _thisArgument_).
1. Let _result_ be the Completion Record of Call(_target_, _wrappedThisArgument_, _argumentsList_).
1. Let _result_ be the Completion Record of Call(_target_, _wrappedThisArgument_, _wrappedArgs_).
1. If _result_.[[Type]] is ~normal~ or _result_.[[Type]] is ~return~, then
1. Return ? GetWrappedValue(_callerRealm_, _result_).
1. Else,
1. Throw a newly created TypeError object associated to the _callerRealm_.
1. Throw a newly created TypeError object associated with the _callerRealm_.
</emu-alg>
<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.
Expand Down Expand Up @@ -136,17 +137,14 @@ <h1>PerformRealmEval ( _sourceText_, _callerRealm_, _evalRealm_ )</h1>
1. Assert: _callerRealm_ is a Realm Record.
1. Assert: _evalRealm_ is a Realm Record.
1. Perform ? HostEnsureCanCompileStrings(_callerRealm_, _evalRealm_).
1. Let _inFunction_ be *false*.
Copy link
Collaborator

Choose a reason for hiding this comment

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

this form was copied from https://tc39.es/ecma262/#sec-performeval. My bad, because the flag for direct eval is not longer needed, therefore these lets declarations are not needed anymore. Good catch!

1. Let _inMethod_ be *false*.
1. Let _inDerivedConstructor_ be *false*.
1. Perform the following substeps in an implementation-defined order, possibly interleaving parsing and error detection:
1. Let _script_ be ParseText(! StringToCodePoints(_sourceText_), |Script|).
1. If _script_ is a List of errors, throw a *SyntaxError* exception.
1. If _script_ Contains |ScriptBody| is *false*, return *undefined*.
1. Let _body_ be the |ScriptBody| of _script_.
1. If _inFunction_ is *false*, and _body_ Contains |NewTarget|, throw a *SyntaxError* exception.
1. If _inMethod_ is *false*, and _body_ Contains |SuperProperty|, throw a *SyntaxError* exception.
1. If _inDerivedConstructor_ is *false*, and _body_ Contains |SuperCall|, throw a *SyntaxError* exception.
1. If _body_ Contains |NewTarget| is *true*, throw a *SyntaxError* exception.
1. If _body_ Contains |SuperProperty| is *true*, throw a *SyntaxError* exception.
1. If _body_ Contains |SuperCall| is *true*, throw a *SyntaxError* exception.
1. Let _strictEval_ be IsStrict of _script_.
1. Let _runningContext_ be the running execution context.
1. Let _lexEnv_ be NewDeclarativeEnvironment(_evalRealm_.[[GlobalEnv]]).
Expand Down Expand Up @@ -223,7 +221,7 @@ <h1>The Realm Constructor</h1>

<emu-clause id="sec-realm">
<h1>Realm ()</h1>
<p>When the `Realm` function is called with no arguments, the following steps are taken:</p>
<p>When the `Realm` function is called, the following steps are taken:</p>
<emu-alg>
1. If NewTarget is *undefined*, throw a *TypeError* exception.
1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, "%Realm.prototype%", « [[Realm]], [[ExecutionContext]] »).
Expand Down