From 25a579773a2bc974b7f5ad85e1c65051020721a4 Mon Sep 17 00:00:00 2001 From: Leo Balter Date: Thu, 20 May 2021 12:16:45 -0700 Subject: [PATCH] Spec fixes, applies review feedback (#309) * Fix steps for [[Call]] Ref https://github.com/tc39/proposal-realms/issues/304\#issuecomment-842736704 * Remove unused spec variables * Clarify the Realm constructor has no parameters Ref https://github.com/tc39/proposal-realms/issues/304\#issuecomment-843312644 * Consistency fix: If foo Contains bar is *true* --- spec.html | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/spec.html b/spec.html index 261e164..5c7a2dd 100644 --- a/spec.html +++ b/spec.html @@ -93,15 +93,16 @@

[[Call]] ( _thisArgument_, _argumentsList_ )

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. + 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_. 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. @@ -136,17 +137,14 @@

PerformRealmEval ( _sourceText_, _callerRealm_, _evalRealm_ )

1. Assert: _callerRealm_ is a Realm Record. 1. Assert: _evalRealm_ is a Realm Record. 1. Perform ? HostEnsureCanCompileStrings(_callerRealm_, _evalRealm_). - 1. Let _inFunction_ be *false*. - 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]]). @@ -223,7 +221,7 @@

The Realm Constructor

Realm ()

-

When the `Realm` function is called with no arguments, the following steps are taken:

+

When the `Realm` function is called, the following steps are taken:

1. If NewTarget is *undefined*, throw a *TypeError* exception. 1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, "%Realm.prototype%", « [[Realm]], [[ExecutionContext]] »).