You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In section 16.1.5 the abstract operation ParseScript is defined as accepting a realm parameter, which may be either a Realm Record or undefined, and is assigned directly into the [[Realm]] field of the resulting record. 16.1.4 reinforces that [[Realm]] may be undefined if "if not yet assigned" (this is in contrast with the following section on Module Records, where [[Realm]] is never undefined). Later, 16.1.6 defines the first step of ScriptEvaluation as
Let globalEnv be scriptRecord.[[Realm]].[[GlobalEnv]].
This implicitly assumes scriptRecord.[[Realm]] is defined, but I don't see anything in the spec to establish this guarantee - not even an Assert. If it's required to have a defined realm, then ParseScript should be updated to no longer accept undefined. On the other hand, if it's allowed to be undefined, then the undefined case should be handled in ScriptEvaluation (presumably either via CreateRealm, or else returning a throw completion).
The text was updated successfully, but these errors were encountered:
Pretty sure this cannot in fact be undefined. 698819c introduced that field, and prior to that commit the [[Realm]] of a Module Record could briefly be undefined if not yet assigned, so our best guess is that this was a refactoring issue during the authoring of that commit.
In section 16.1.5 the abstract operation ParseScript is defined as accepting a realm parameter, which may be either a Realm Record or undefined, and is assigned directly into the [[Realm]] field of the resulting record. 16.1.4 reinforces that [[Realm]] may be undefined if "if not yet assigned" (this is in contrast with the following section on Module Records, where [[Realm]] is never undefined). Later, 16.1.6 defines the first step of ScriptEvaluation as
This implicitly assumes scriptRecord.[[Realm]] is defined, but I don't see anything in the spec to establish this guarantee - not even an Assert. If it's required to have a defined realm, then ParseScript should be updated to no longer accept undefined. On the other hand, if it's allowed to be undefined, then the undefined case should be handled in ScriptEvaluation (presumably either via CreateRealm, or else returning a throw completion).
The text was updated successfully, but these errors were encountered: