From 265ddac88b1d7b69da86a48b80b45ce82c99b262 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Wed, 20 Nov 2024 16:53:27 -0800 Subject: [PATCH] Rebase Source Phase Imports Proposal --- spec.html | 289 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 248 insertions(+), 41 deletions(-) diff --git a/spec.html b/spec.html index 34a4096181..69af00411f 100644 --- a/spec.html +++ b/spec.html @@ -3280,6 +3280,17 @@

Well-Known Intrinsic Objects

+ + + %AbstractModuleSource% + + + `AbstractModuleSource` + + + The `AbstractModuleSource` constructor () + + %AggregateError% @@ -19057,6 +19068,8 @@

Syntax

ImportCall[Yield, Await] : `import` `(` AssignmentExpression[+In, ?Yield, ?Await] `,`? `)` `import` `(` AssignmentExpression[+In, ?Yield, ?Await] `,` AssignmentExpression[+In, ?Yield, ?Await] `,`? `)` + `import` `.` `source` `(` AssignmentExpression[+In, ?Yield, ?Await] `,`? `)` + `import` `.` `source` `(` AssignmentExpression[+In, ?Yield, ?Await] `,` AssignmentExpression[+In, ?Yield, ?Await] `,`? `)` Arguments[Yield, Await] : `(` `)` @@ -19617,12 +19630,22 @@

Runtime Semantics: Evaluation

ImportCall : `import` `(` AssignmentExpression `,`? `)` - 1. Return ? EvaluateImportCall(|AssignmentExpression|). + 1. Return ? EvaluateImportCall(|AssignmentExpression|, ~evaluation~). ImportCall : `import` `(` AssignmentExpression `,` AssignmentExpression `,`? `)` - 1. Return ? EvaluateImportCall(the first |AssignmentExpression|, the second |AssignmentExpression|). + 1. Return ? EvaluateImportCall(the first |AssignmentExpression|, ~evaluation~, the second |AssignmentExpression|). + + + ImportCall : `import` `.` `source` `(` AssignmentExpression `,` AssignmentExpression `,`? `)` + + 1. Return ? EvaluateImportCall(|AssignmentExpression|, ~source~). + + + ImportCall : `import` `.` `source` `(` AssignmentExpression `,` AssignmentExpression `,`? `)` + + 1. Return ? EvaluateImportCall(the first |AssignmentExpression|, ~source~, the second |AssignmentExpression|). @@ -19630,6 +19653,7 @@

Runtime Semantics: Evaluation

EvaluateImportCall ( _specifierExpression_: a Parse Node, + _phase_: ~source~ or ~evaluation~, optional _optionsExpression_: a Parse Node, ): either a normal completion containing a Promise or a throw completion

@@ -19673,7 +19697,7 @@

1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »). 1. Return _promiseCapability_.[[Promise]]. 1. Sort _attributes_ according to the lexicographic order of their [[Key]] fields, treating the value of each such field as a sequence of UTF-16 code unit values. NOTE: This sorting is observable only in that hosts are prohibited from changing behaviour based on the order in which attributes are enumerated. - 1. Let _moduleRequest_ be a new ModuleRequest Record { [[Specifier]]: _specifierString_, [[Attributes]]: _attributes_ }. + 1. Let _moduleRequest_ be a new ModuleRequest Record { [[Specifier]]: _specifierString_, [[Phase]]: _phase_, [[Attributes]]: _attributes_ }. 1. Perform HostLoadImportedModule(_referrer_, _moduleRequest_, ~empty~, _promiseCapability_). 1. Return _promiseCapability_.[[Promise]]. @@ -19683,6 +19707,7 @@

ContinueDynamicImport ( _promiseCapability_: a PromiseCapability Record, + _phase_: ~source~ or ~evaluation~, _moduleCompletion_: either a normal completion containing a Module Record or a throw completion, ): ~unused~

@@ -19695,6 +19720,13 @@

1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _moduleCompletion_.[[Value]] »). 1. Return ~unused~. 1. Let _module_ be _moduleCompletion_.[[Value]]. + 1. If _phase_ is ~source~, then + 1. Let _moduleSourceCompletion_ be Completion(_module_.GetModuleSource()). + 1. If _moduleSourceCompletion_ is an abrupt completion, then + 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _moduleSourceCompletion_.[[Value]] »). + 1. Else, + 1. Perform ! Call(_promiseCapability_.[[Resolve]], *undefined*, « _moduleSourceCompletion_.[[Value]] »). + 1. Return ~unused~. 1. Let _loadPromise_ be _module_.LoadRequestedModules(). 1. Let _rejectedClosure_ be a new Abstract Closure with parameters (_reason_) that captures _promiseCapability_ and performs the following steps when called: 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « _reason_ »). @@ -26260,6 +26292,17 @@

ModuleRequest Records

The module specifier + + + [[Phase]] + + + ~source~ or ~evaluation~ + + + The target import phase + + [[Attributes]] @@ -26274,7 +26317,7 @@

ModuleRequest Records

-

A LoadedModuleRequest Record represents the request to import a module together with the resulting Module Record. It consists of the same fields defined in table , with the addition of [[Module]]:

+

A LoadedModuleRequest Record represents the request to import a module together with the resulting Module Record. It consists of the [[Specifier]] and [[Attributes]] fields defined in table , with the addition of [[Module]]:

@@ -26425,31 +26468,42 @@

Static Semantics: ModuleRequests ( ): a List of ModuleRequest Records

ImportDeclaration : `import` ImportClause FromClause `;` 1. Let _specifier_ be the SV of |FromClause|. - 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Attributes]]: « » }. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~evaluation~, [[Attributes]]: « » }. ImportDeclaration : `import` ImportClause FromClause WithClause `;` 1. Let _specifier_ be the SV of |FromClause|. 1. Let _attributes_ be WithClauseToAttributes of |WithClause|. - 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Attributes]]: _attributes_ }. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~evaluation~, [[Attributes]]: _attributes_ }. + + ImportDeclaration : `import` `source` ImportedBinding FromClause `;` + + 1. Let _specifier_ be the SV of |FromClause|. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~source~, [[Attributes]]: « » }. + + ImportDeclaration : `import` `source` ImportedBinding FromClause WithClause `;` + + 1. Let _specifier_ be the SV of |FromClause|. + 1. Let _attributes_ be WithClauseToAttributes of |WithClause|. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~source~, [[Attributes]]: _attributes_ }. ImportDeclaration : `import` ModuleSpecifier `;` 1. Let _specifier_ be the SV of |ModuleSpecifier|. - 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Attributes]]: « » }. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~evaluation~, [[Attributes]]: « » }. ImportDeclaration : `import` ModuleSpecifier WithClause `;` 1. Let _specifier_ be the SV of |ModuleSpecifier|. 1. Let _attributes_ be WithClauseToAttributes of |WithClause|. - 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Attributes]]: _attributes_ }. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~evaluation~, [[Attributes]]: _attributes_ }. ExportDeclaration : `export` ExportFromClause FromClause `;` 1. Let _specifier_ be the SV of |FromClause|. - 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Attributes]]: « » }. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~evaluation~, [[Attributes]]: « » }. ExportDeclaration : `export` ExportFromClause FromClause WithClause `;` @@ -26457,7 +26511,7 @@

Static Semantics: ModuleRequests ( ): a List of ModuleRequest Records

1. Let _specifier_ be the SV of |FromClause|. 1. Let _attributes_ be WithClauseToAttributes of |WithClause|. - 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Attributes]]: _attributes_ }. + 1. Return a List whose sole element is the ModuleRequest Record { [[Specifier]]: _specifier_, [[Phase]]: ~evaluation~, [[Attributes]]: _attributes_ }. ExportDeclaration : @@ -26596,6 +26650,17 @@

Abstract Module Records

Link must have completed successfully prior to invoking this method.

+ + + +
+ GetModuleSource() + +

It returns either a normal completion containing the Module Source Object corresponding to this source Module Record's source phase (), or a throw completion.

+

When called multiple times on the same Module Record, if GetModuleSource() returns a normal completion it must always return a normal completion containing the same object.

+

The returned object should have a [[Prototype]] internal slot whose value is %AbstractModuleSource.prototype%.

+

For Module Records that do not have a source representation, GetModuleSource() must always return a throw completion whose [[Value]] is a *SyntaxError*.

+
@@ -26671,7 +26736,7 @@

Cyclic Module Records

a List of ModuleRequest Records - A List of the ModuleRequest Records associated with the imports in this module. The List is in source text occurrence order of the imports. + A List of the ModuleRequest Records associated with the imports in this module, along with their associated phase (~source~ or ~evaluation~). The List is in source text occurrence order of the imports. @@ -26877,7 +26942,7 @@

1. If _hostDefined_ is not present, let _hostDefined_ be ~empty~. 1. Let _pc_ be ! NewPromiseCapability(%Promise%). 1. Let _state_ be the GraphLoadingState Record { [[IsLoading]]: *true*, [[PendingModulesCount]]: 1, [[Visited]]: « », [[PromiseCapability]]: _pc_, [[HostDefined]]: _hostDefined_ }. - 1. Perform InnerModuleLoading(_state_, _module_). + 1. Perform InnerModuleLoading(_state_, _module_, ~recursive-load~). 1. Return _pc_.[[Promise]]. @@ -26891,6 +26956,7 @@

InnerModuleLoading ( _state_: a GraphLoadingState Record, _module_: a Module Record, + _loadType_: ~single~ or ~recursive-load~, ): ~unused~

@@ -26900,16 +26966,17 @@

1. Assert: _state_.[[IsLoading]] is *true*. - 1. If _module_ is a Cyclic Module Record, _module_.[[Status]] is ~new~, and _state_.[[Visited]] does not contain _module_, then + 1. If _loadType_ is ~recursive-load~, _module_ is a Cyclic Module Record, _module_.[[Status]] is ~new~, and _state_.[[Visited]] does not contain _module_, then 1. Append _module_ to _state_.[[Visited]]. 1. Let _requestedModulesCount_ be the number of elements in _module_.[[RequestedModules]]. 1. Set _state_.[[PendingModulesCount]] to _state_.[[PendingModulesCount]] + _requestedModulesCount_. 1. For each ModuleRequest Record _request_ of _module_.[[RequestedModules]], do 1. If AllImportAttributesSupported(_request_.[[Attributes]]) is *false*, then 1. Let _error_ be ThrowCompletion(a newly created *SyntaxError* object). - 1. Perform ContinueModuleLoading(_state_, _error_). + 1. Perform ContinueModuleLoading(_state_, _request_.[[Phase]], _error_). 1. Else if _module_.[[LoadedModules]] contains a LoadedModuleRequest Record _record_ such that ModuleRequestsEqual(_record_, _request_) is *true*, then - 1. Perform InnerModuleLoading(_state_, _record_.[[Module]]). + 1. If _request_.[[Phase]] is ~source~, let _innerLoadType_ be ~single~; otherwise let _innerLoadType_ be ~recursive-load~. + 1. Perform InnerModuleLoading(_state_, _record_.[[Module]], _innerLoadType_). 1. Else, 1. Perform HostLoadImportedModule(_module_, _request_, _state_.[[HostDefined]], _state_). 1. NOTE: HostLoadImportedModule will call FinishLoadingImportedModule, which re-enters the graph loading process through ContinueModuleLoading. @@ -26929,6 +26996,7 @@

ContinueModuleLoading ( _state_: a GraphLoadingState Record, + _phase_: ~source~ or ~evaluation~, _moduleCompletion_: either a normal completion containing a Module Record or a throw completion, ): ~unused~

@@ -26940,7 +27008,8 @@

1. If _state_.[[IsLoading]] is *false*, return ~unused~. 1. If _moduleCompletion_ is a normal completion, then - 1. Perform InnerModuleLoading(_state_, _moduleCompletion_.[[Value]]). + 1. If _phase_ is ~source~, let _loadType_ be ~single~; otherwise let _loadType_ be ~recursive-load~. + 1. Perform InnerModuleLoading(_state_, _moduleCompletion_.[[Value]], _loadType_). 1. Else, 1. Set _state_.[[IsLoading]] to *false*. 1. Perform ! Call(_state_.[[PromiseCapability]].[[Reject]], *undefined*, « _moduleCompletion_.[[Value]] »). @@ -27000,13 +27069,14 @@

1. Set _index_ to _index_ + 1. 1. Append _module_ to _stack_. 1. For each ModuleRequest Record _request_ of _module_.[[RequestedModules]], do - 1. Let _requiredModule_ be GetImportedModule(_module_, _request_). - 1. Set _index_ to ? InnerModuleLinking(_requiredModule_, _stack_, _index_). - 1. If _requiredModule_ is a Cyclic Module Record, then - 1. Assert: _requiredModule_.[[Status]] is one of ~linking~, ~linked~, ~evaluating-async~, or ~evaluated~. - 1. Assert: _requiredModule_.[[Status]] is ~linking~ if and only if _stack_ contains _requiredModule_. - 1. If _requiredModule_.[[Status]] is ~linking~, then - 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). + 1. If _request_.[[Phase]] is ~evaluation~, then + 1. Let _requiredModule_ be GetImportedModule(_module_, _request_). + 1. Set _index_ to ? InnerModuleLinking(_requiredModule_, _stack_, _index_). + 1. If _requiredModule_ is a Cyclic Module Record, then + 1. Assert: _requiredModule_.[[Status]] is one of ~linking~, ~linked~, ~evaluating-async~, or ~evaluated~. + 1. Assert: _requiredModule_.[[Status]] is ~linking~ if and only if _stack_ contains _requiredModule_. + 1. If _requiredModule_.[[Status]] is ~linking~, then + 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). 1. Perform ? _module_.InitializeEnvironment(). 1. Assert: _module_ occurs exactly once in _stack_. 1. Assert: _module_.[[DFSAncestorIndex]] ≤ _module_.[[DFSIndex]]. @@ -27093,20 +27163,21 @@

1. Set _index_ to _index_ + 1. 1. Append _module_ to _stack_. 1. For each ModuleRequest Record _request_ of _module_.[[RequestedModules]], do - 1. Let _requiredModule_ be GetImportedModule(_module_, _request_). - 1. Set _index_ to ? InnerModuleEvaluation(_requiredModule_, _stack_, _index_). - 1. If _requiredModule_ is a Cyclic Module Record, then - 1. Assert: _requiredModule_.[[Status]] is one of ~evaluating~, ~evaluating-async~, or ~evaluated~. - 1. Assert: _requiredModule_.[[Status]] is ~evaluating~ if and only if _stack_ contains _requiredModule_. - 1. If _requiredModule_.[[Status]] is ~evaluating~, then - 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). - 1. Else, - 1. Set _requiredModule_ to _requiredModule_.[[CycleRoot]]. - 1. Assert: _requiredModule_.[[Status]] is either ~evaluating-async~ or ~evaluated~. - 1. If _requiredModule_.[[EvaluationError]] is not ~empty~, return ? _requiredModule_.[[EvaluationError]]. - 1. If _requiredModule_.[[AsyncEvaluation]] is *true*, then - 1. Set _module_.[[PendingAsyncDependencies]] to _module_.[[PendingAsyncDependencies]] + 1. - 1. Append _module_ to _requiredModule_.[[AsyncParentModules]]. + 1. If _request_.[[Phase]] is ~evaluation~, then + 1. Let _requiredModule_ be GetImportedModule(_module_, _request_). + 1. Set _index_ to ? InnerModuleEvaluation(_requiredModule_, _stack_, _index_). + 1. If _requiredModule_ is a Cyclic Module Record, then + 1. Assert: _requiredModule_.[[Status]] is one of ~evaluating~, ~evaluating-async~, or ~evaluated~. + 1. Assert: _requiredModule_.[[Status]] is ~evaluating~ if and only if _stack_ contains _requiredModule_. + 1. If _requiredModule_.[[Status]] is ~evaluating~, then + 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). + 1. Else, + 1. Set _requiredModule_ to _requiredModule_.[[CycleRoot]]. + 1. Assert: _requiredModule_.[[Status]] is either ~evaluating-async~ or ~evaluated~. + 1. If _requiredModule_.[[EvaluationError]] is not ~empty~, return ? _requiredModule_.[[EvaluationError]]. + 1. If _requiredModule_.[[AsyncEvaluation]] is *true*, then + 1. Set _module_.[[PendingAsyncDependencies]] to _module_.[[PendingAsyncDependencies]] + 1. + 1. Append _module_ to _requiredModule_.[[AsyncParentModules]]. 1. If _module_.[[PendingAsyncDependencies]] > 0 or _module_.[[HasTLA]] is *true*, then 1. Assert: _module_.[[AsyncEvaluation]] is *false* and was never previously set to *true*. 1. Set _module_.[[AsyncEvaluation]] to *true*. @@ -27883,10 +27954,10 @@

Source Text Module Records

[[ImportName]] - a String or ~namespace-object~ + a String, ~namespace-object~ or ~source~ - The name under which the desired binding is exported by the module identified by [[ModuleRequest]]. The value ~namespace-object~ indicates that the import request is for the target module's namespace object. + The name under which the desired binding is exported by the module identified by [[ModuleRequest]]. The value ~namespace-object~ indicates that the import request is for the target module's namespace object. The value ~source~ represents an import at the source phase. @@ -28400,6 +28471,24 @@

+ +

+ GetModuleSource ( ): either a normal completion containing an Object or a throw completion +

+
+
for
+
a Source Text Module Record _module_
+ +
description
+
+

Source Text Module Record provides a GetModuleSource implementation that always returns an abrupt completion indicating that a source phase import is not available.

+
+
+ + 1. Throw a *SyntaxError* exception. + +
+

InitializeEnvironment ( ): either a normal completion containing ~unused~ or a throw completion

@@ -28424,6 +28513,10 @@

InitializeEnvironment ( ): either a normal completion containing ~unused~ or 1. Let _namespace_ be GetModuleNamespace(_importedModule_). 1. Perform ! _env_.CreateImmutableBinding(_in_.[[LocalName]], *true*). 1. Perform ! _env_.InitializeBinding(_in_.[[LocalName]], _namespace_). + 1. Else if _in_.[[ImportName]] is ~source~, then + 1. Let _moduleSourceObject_ be ? _importedModule_.GetModuleSource(). + 1. Perform ! _env_.CreateImmutableBinding(_in_.[[LocalName]], *true*). + 1. Perform ! _env_.InitializeBinding(_in_.[[LocalName]], _moduleSourceObject_). 1. Else, 1. Let _resolution_ be _importedModule_.ResolveExport(_in_.[[ImportName]]). 1. If _resolution_ is either *null* or ~ambiguous~, throw a *SyntaxError* exception. @@ -28559,12 +28652,19 @@

and it performs FinishLoadingImportedModule(_referrer_, _moduleRequest_, _payload_, _result_) where _result_ is a normal completion, then it must perform FinishLoadingImportedModule(_referrer_, _moduleRequest_, _payload_, _result_) with the same _result_ each time.

+
  • + The completion record returned by this operation must not be affected by _moduleRequest_.[[Phase]]. +
  • The operation must treat _payload_ as an opaque value to be passed through to FinishLoadingImportedModule.
  • The actual process performed is host-defined, but typically consists of performing whatever I/O operations are necessary to load the appropriate Module Record. Multiple different (_referrer_, _moduleRequest_.[[Specifier]], _moduleRequest_.[[Attributes]]) triples may map to the same Module Record instance. The actual mapping semantics is host-defined but typically a normalization process is applied to _specifier_ as part of the mapping process. A typical normalization process would include actions such as expansion of relative and abbreviated path specifiers.

    + + +

    Implementations may provide unobservable module loading optimizations, such as speculative preloading of modules that are likely to be requested next. When doing so, they should consider whether the module is being imported for its ~source~ phase, which won't cause calls to the HostLoadImportedModule hook for its transitive dependencies, or for its ~evaluation~ phase, which will.

    +
    @@ -28587,13 +28687,35 @@

    1. Else, 1. Append the LoadedModuleRequest Record { [[Specifier]]: _moduleRequest_.[[Specifier]], [[Attributes]]: _moduleRequest_.[[Attributes]], [[Module]]: _result_.[[Value]] } to _referrer_.[[LoadedModules]]. 1. If _payload_ is a GraphLoadingState Record, then - 1. Perform ContinueModuleLoading(_payload_, _result_). + 1. Perform ContinueModuleLoading(_payload_, _moduleRequest_.[[Phase]], _result_). 1. Else, - 1. Perform ContinueDynamicImport(_payload_, _result_). + 1. Perform ContinueDynamicImport(_payload_, _moduleRequest_.[[Phase]], _result_). 1. Return ~unused~. + +

    + HostGetModuleSourceName ( + _moduleSource_: an Object, + ): either a normal completion containing a String or a throw completion +

    +
    +
    description
    +
    +
    + +

    An implementation of HostGetModuleSourceName must conform to the following requirements:

    +
      +
    • + For any object that is a Module Source Object, returns a normal completion for a String corresponding to the source record type to be used as the strongly branded return value of the @@toStringTag getter on %AbstractModuleSource%. +
    • +
    • + For any object which is not a Module Source Object, returns a throw completion. +
    • +
    +
    +

    AllImportAttributesSupported ( @@ -28696,6 +28818,7 @@

    Syntax

    ImportDeclaration : `import` ImportClause FromClause WithClause? `;` `import` ModuleSpecifier WithClause? `;` + `import` `source` ImportedBinding FromClause WithClause? `;` ImportClause : ImportedDefaultBinding @@ -28793,6 +28916,13 @@

    Static Semantics: ImportEntries ( ): a List of ImportEntry Records

    1. Return a new empty List. + ImportDeclaration : `import` `source` ImportedBinding FromClause WithClause? `;` + + 1. Let _module_ be the sole element of the ModuleRequests of |ImportDeclaration|. + 1. Let _localName_ be the sole element of BoundNames of |ImportedBinding|. + 1. Let _entry_ be the ImportEntry Record { [[ModuleRequest]]: _module_, [[ImportName]]: ~source~, [[LocalName]]: _localName_ }. + 1. Return « _entry_ ». +
    @@ -49541,6 +49671,82 @@

    %Symbol.toStringTag%

    This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.

    + + +

    Module Source Objects

    +

    Module Source Objects represent modules in their source import phase, which are not linked, instantiated or executed.

    +

    A Module Source Object is an object for which HostGetModuleSourceName returns a normal completion.

    +

    All Module Source Objects should have a prototype of %AbstractModuleSource%.prototype.

    +

    Hosts may define their own %AbstractModuleSource% subclasses for custom module types.

    + + +

    The AbstractModuleSource Constructor

    +

    The AbstractModuleSource constructor:

    +
      +
    • is %AbstractModuleSource%.
    • +
    • along with its corresponding prototype object, provides common properties that are inherited by Module Source constructors and their instances.
    • +
    • does not have a global name or appear as a property of the global object.
    • +
    • acts as a common superclass of the constructors of Module Source Objects.
    • +
    • will throw an error when invoked, because it is an abstract class constructor. The module source constructors do not perform a `super` call to it.
    • +
    + + +

    AbstractModuleSource ( )

    +

    This function performs the following steps when called:

    + + 1. Throw a *TypeError* exception. + +
    +
    + + +

    Properties of the %AbstractModuleSource% Intrinsic Object

    +

    The %AbstractModuleSource% intrinsic object:

    +
      +
    • has a [[Prototype]] internal slot whose value is %Function.prototype%.
    • +
    • has a *"name"* property whose value is *"AbstractModuleSource"*.
    • +
    • has the following properties:
    • +
    + + +

    %AbstractModuleSource%.prototype

    +

    The initial value of %AbstractModuleSource%`.prototype` is the %AbstractModuleSource% prototype object.

    +

    This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.

    +
    +
    + + +

    Properties of the %AbstractModuleSource% Prototype Object

    +

    The %AbstractModuleSource% prototype object:

    +
      +
    • has a [[Prototype]] internal slot whose value is %Object.prototype%.
    • +
    • is %AbstractModuleSource.prototype%.
    • +
    • is an ordinary object.
    • +
    • has the following properties:
    • +
    + + +

    %AbstractModuleSource%.prototype.constructor

    +

    The initial value of %AbstractModuleSource%`.prototype.constructor` is %AbstractModuleSource%.

    +
    + + +

    get %AbstractModuleSource%.prototype [ @@toStringTag ]

    +

    %AbstractModuleSource%.prototype `[@@toStringTag]` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps when called:

    + + 1. Let _O_ be the *this* value. + 1. If _O_ is not an Object, return *undefined*. + 1. Let _sourceNameResult_ be Completion(HostGetModuleSourceName(_O_)). + 1. If _sourceNameResult_ is an abrupt completion, return *undefined*. + 1. Let _name_ be ! _sourceNameResult_. + 1. Assert: _name_ is a String. + 1. Return _name_. + +

    This property has the attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }.

    +

    The initial value of the *"name"* property of this function is *"get [Symbol.toStringTag]"*.

    +
    +
    +
    @@ -51794,6 +52000,7 @@

    Host Hooks

    HostEnsureCanCompileStrings(...)

    HostFinalizeImportMeta(...)

    HostGetImportMetaProperties(...)

    +

    HostGetModuleSourceName(...)

    HostGrowSharedArrayBuffer(...)

    HostHasSourceTextAvailable(...)

    HostLoadImportedModule(...)