diff --git a/README.md b/README.md
index 2a954b1..6458dad 100644
--- a/README.md
+++ b/README.md
@@ -130,7 +130,9 @@ Returns metadata about the modular structure of the module:
```ts
interface ModuleMetadata {
imports: Import[],
- topLevelAwait: bool,
+ hasDynamicImport: bool,
+ hasImportMeta: bool,
+ hasTopLevelAwait: bool,
}
```
@@ -143,7 +145,10 @@ interface Import {
}
```
-`topLevelAwait` is *true* if and only if there is usage of top-level await in the module.
+* `hasDynamicImport` is *true* if and only if there is usage of dynamic import.
+* `hasImportMeta` is *true* if and only if there is usage of import meta.
+* `hasTopLevelAwait` is *true* if and only if there is usage of top-level await in the module.
+
### Dynamic Import
diff --git a/spec.emu b/spec.emu
index 25db848..322f26b 100644
--- a/spec.emu
+++ b/spec.emu
@@ -1183,6 +1183,28 @@ contributors: Luca Casonato, Guy Bedford
Whether this module is individually asynchronous (for example, if it's a Source Text Module Record containing a top-level await). Having an asynchronous dependency does not mean this field is *true*. This field must not change after the module is parsed.
+
[[AsyncEvaluation]]
@@ -1254,7 +1276,9 @@ contributors: Luca Casonato, Guy Bedford
1. Append _import_ to _imports_.
1. Let _importsArray_ be CreateArrayFromList(_imports_).
1. Perform ! CreateDataPropertyOrThrow(_metadata_, *"imports"*, _importsArray_).
- 1. Perform ! CreateDataPropertyOrThrow(_metadata_, *"topLevelAwait"*, _module_.[[HasTLA]]).
+ 1. Perform ! CreateDataPropertyOrThrow(_metadata_, *"hasDynamicImport"*, _module_.[[HasDynamicImport]]).
+ 1. Perform ! CreateDataPropertyOrThrow(_metadata_, *"hasImportMeta"*, _module_.[[HasImportMeta]]).
+ 1. Perform ! CreateDataPropertyOrThrow(_metadata_, *"hasTopLevelAwait"*, _module_.[[HasTLA]]).
1. Return _metadata_.
@@ -1263,6 +1287,55 @@ contributors: Luca Casonato, Guy Bedford
Source Text Module Records
+
+
+ ParseModule (
+ _sourceText_: ECMAScript source text,
+ _realm_: a Realm Record,
+ _hostDefined_: anything,
+ ): a Source Text Module Record or a non-empty List of *SyntaxError* objects
+
+
+
+ 1. Let _body_ be ParseText(_sourceText_, |Module|).
+ 1. If _body_ is a List of errors, return _body_.
+ 1. Let _requestedModules_ be the ModuleRequests of _body_.
+ 1. Let _importEntries_ be ImportEntries of _body_.
+ 1. Let _importedBoundNames_ be ImportedLocalNames(_importEntries_).
+ 1. Let _indirectExportEntries_ be a new empty List.
+ 1. Let _localExportEntries_ be a new empty List.
+ 1. Let _starExportEntries_ be a new empty List.
+ 1. Let _exportEntries_ be ExportEntries of _body_.
+ 1. For each ExportEntry Record _ee_ of _exportEntries_, do
+ 1. If _ee_.[[ModuleRequest]] is *null*, then
+ 1. If _importedBoundNames_ does not contain _ee_.[[LocalName]], then
+ 1. Append _ee_ to _localExportEntries_.
+ 1. Else,
+ 1. Let _ie_ be the element of _importEntries_ whose [[LocalName]] is _ee_.[[LocalName]].
+ 1. If _ie_.[[ImportName]] is ~namespace-object~, then
+ 1. NOTE: This is a re-export of an imported module namespace object.
+ 1. Append _ee_ to _localExportEntries_.
+ 1. Else,
+ 1. NOTE: This is a re-export of a single name.
+ 1. Append the ExportEntry Record { [[ModuleRequest]]: _ie_.[[ModuleRequest]], [[ImportName]]: _ie_.[[ImportName]], [[LocalName]]: *null*, [[ExportName]]: _ee_.[[ExportName]] } to _indirectExportEntries_.
+ 1. Else if _ee_.[[ImportName]] is ~all-but-default~, then
+ 1. Assert: _ee_.[[ExportName]] is *null*.
+ 1. Append _ee_ to _starExportEntries_.
+ 1. Else,
+ 1. Append _ee_ to _indirectExportEntries_.
+ 1. Let _async_ be _body_ Contains `await`.
+ 1. Let _importMeta_ be _body_ Contains |ImportMeta|.
+ 1. Let _dynamicImport_ be _body_ Contains |ImportCall|.
+ 1. Return Source Text Module Record { [[Realm]]: _realm_, [[Environment]]: ~empty~, [[Namespace]]: ~empty~, [[ModuleSource]]: ~empty~, [[CycleRoot]]: ~empty~, [[HasTLA]]: _async_, [[HasImportMeta]]: _importMeta_, [[HasDynamicImport]]: _dynamicImport_, [[AsyncEvaluation]]: *false*, [[TopLevelCapability]]: ~empty~, [[AsyncParentModules]]: « », [[PendingAsyncDependencies]]: ~empty~, [[Status]]: ~new~, [[EvaluationError]]: ~empty~, [[HostDefined]]: _hostDefined_, [[ECMAScriptCode]]: _body_, [[Context]]: ~empty~, [[ImportMeta]]: ~empty~, [[RequestedModules]]: _requestedModules_, [[LoadedModules]]: « », [[ImportEntries]]: _importEntries_, [[LocalExportEntries]]: _localExportEntries_, [[IndirectExportEntries]]: _indirectExportEntries_, [[StarExportEntries]]: _starExportEntries_, [[DFSIndex]]: ~empty~, [[DFSAncestorIndex]]: ~empty~ }.
+
+
+ An implementation may parse module source text and analyse it for Early Error conditions prior to the evaluation of ParseModule for that module source text. However, the reporting of any errors must be deferred until the point where this specification actually performs ParseModule upon that source text.
+
+
+
GetModuleSource ( ): either a normal completion containing an Object or a throw completion
|