diff --git a/build/index.html b/build/index.html index 1cc60b9..73c164c 100644 --- a/build/index.html +++ b/build/index.html @@ -3993,7 +3993,7 @@

Stage 2.7 Draft / March 24, 2026

ECMAScript Module Phase Imports

+

Stage 2.7 Draft / April 25, 2026

ECMAScript Module Phase Imports

1 ECMAScript Data Types and Values

@@ -4808,7 +4808,7 @@

13.3.10 Import Calls

13.3.10.1 EvaluateImportCall ( specifierExpression, phase [ , optionsExpression ] )

The abstract operation EvaluateImportCall takes arguments specifierExpression (a Parse Node) and phase (source or evaluation) and optional argument optionsExpression (a Parse Node) and returns either a normal completion containing a Promise or a throw completion. It performs the following steps when called:

-
  1. Let referrer be GetActiveScriptOrModule().
  2. If referrer is null, set referrer to the current Realm Record.
  3. Let specifierRef be ? Evaluation of specifierExpression.
  4. Let specifier be ? GetValue(specifierRef).
  5. If optionsExpression is present, then
    1. Let optionsRef be ? Evaluation of optionsExpression.
    2. Let options be ? GetValue(optionsRef).
  6. Else,
    1. Let options be undefined.
  7. Let promiseCapability be ! NewPromiseCapability(%Promise%).
  8. Let attributesObj be undefined.
  9. If specifier is an Object, then
    1. Let moduleSourceRecord be GetModuleSourceRecord(specifier).
    2. If moduleSourceRecord is not not-a-source, then
      1. If options is not undefined, then
        1. If options is not an Object, then
          1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
          2. Return promiseCapability.[[Promise]].
        2. Set attributesObj to Completion(Get(options, "with")).
        3. IfAbruptRejectPromise(attributesObj, promiseCapability).
      2. If attributesObj is not undefined, then
        1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
        2. Return promiseCapability.[[Promise]].
      3. Let proto be ? specifier.[[GetPrototypeOf]]().
      4. Let superProto be ? proto.[[GetPrototypeOf]]().
      5. if SameValue(superProto, %AbstractModuleSource.prototype%) is false, then:
        1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
        2. Return promiseCapability.[[Promise]].
      6. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: moduleSourceRecord, [[Phase]]: phase, [[Attributes]]: « » }.
      7. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
      8. Return promiseCapability.[[Promise]].
  10. Let specifierString be Completion(ToString(specifier)).
  11. IfAbruptRejectPromise(specifierString, promiseCapability).
  12. Let attributes be a new empty List.
  13. If options is not undefined, then
    1. If options is not an Object, then
      1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
      2. Return promiseCapability.[[Promise]].
    2. Set attributesObj to Completion(Get(options, "with")).
    3. IfAbruptRejectPromise(attributesObj, promiseCapability).
    4. If attributesObj is not undefined, then
      1. If attributesObj is not an Object, then
        1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
        2. Return promiseCapability.[[Promise]].
      2. Let entries be Completion(EnumerableOwnProperties(attributesObj, key+value)).
      3. IfAbruptRejectPromise(entries, promiseCapability).
      4. For each element entry of entries, do
        1. Let key be ! Get(entry, "0").
        2. Let value be ! Get(entry, "1").
        3. If key is a String, then
          1. If value is not a String, then
            1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
            2. Return promiseCapability.[[Promise]].
          2. Append the ImportAttribute Record { [[Key]]: key, [[Value]]: value } to attributes.
    5. If AllImportAttributesSupported(attributes) is false, then
      1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
      2. Return promiseCapability.[[Promise]].
    6. 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.
  14. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase, [[Attributes]]: attributes }.
  15. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
  16. Return promiseCapability.[[Promise]].
+
  1. Let referrer be GetActiveScriptOrModule().
  2. If referrer is null, set referrer to the current Realm Record.
  3. Let specifierRef be ? Evaluation of specifierExpression.
  4. Let specifier be ? GetValue(specifierRef).
  5. If optionsExpression is present, then
    1. Let optionsRef be ? Evaluation of optionsExpression.
    2. Let options be ? GetValue(optionsRef).
  6. Else,
    1. Let options be undefined.
  7. Let promiseCapability be ! NewPromiseCapability(%Promise%).
  8. Let attributesObj be undefined.
  9. If specifier is an Object, then
    1. Let moduleSourceRecord be GetModuleSourceRecord(specifier).
    2. If moduleSourceRecord is not not-a-source, then
      1. If options is not undefined, then
        1. If options is not an Object, then
          1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
          2. Return promiseCapability.[[Promise]].
        2. Set attributesObj to Completion(Get(options, "with")).
        3. IfAbruptRejectPromise(attributesObj, promiseCapability).
      2. If attributesObj is not undefined, then
        1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
        2. Return promiseCapability.[[Promise]].
      3. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: moduleSourceRecord, [[Phase]]: phase, [[Attributes]]: « » }.
      4. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
      5. Return promiseCapability.[[Promise]].
  10. Let specifierString be Completion(ToString(specifier)).
  11. IfAbruptRejectPromise(specifierString, promiseCapability).
  12. Let attributes be a new empty List.
  13. If options is not undefined, then
    1. If options is not an Object, then
      1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
      2. Return promiseCapability.[[Promise]].
    2. Set attributesObj to Completion(Get(options, "with")).
    3. IfAbruptRejectPromise(attributesObj, promiseCapability).
    4. If attributesObj is not undefined, then
      1. If attributesObj is not an Object, then
        1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
        2. Return promiseCapability.[[Promise]].
      2. Let entries be Completion(EnumerableOwnProperties(attributesObj, key+value)).
      3. IfAbruptRejectPromise(entries, promiseCapability).
      4. For each element entry of entries, do
        1. Let key be ! Get(entry, "0").
        2. Let value be ! Get(entry, "1").
        3. If key is a String, then
          1. If value is not a String, then
            1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
            2. Return promiseCapability.[[Promise]].
          2. Append the ImportAttribute Record { [[Key]]: key, [[Value]]: value } to attributes.
    5. If AllImportAttributesSupported(attributes) is false, then
      1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
      2. Return promiseCapability.[[Promise]].
    6. 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.
  14. Let moduleRequest be a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase, [[Attributes]]: attributes }.
  15. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
  16. Return promiseCapability.[[Promise]].
diff --git a/spec.emu b/spec.emu index 32cdf63..66b30bc 100644 --- a/spec.emu +++ b/spec.emu @@ -853,11 +853,6 @@ contributors: Luca Casonato, Guy Bedford 1. If _attributesObj_ is not *undefined*, then 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »). 1. Return _promiseCapability_.[[Promise]]. - 1. Let _proto_ be ? _specifier_.[[GetPrototypeOf]](). - 1. Let _superProto_ be ? _proto_.[[GetPrototypeOf]](). - 1. if SameValue(_superProto_, %AbstractModuleSource.prototype%) is *false*, then: - 1. Perform ! Call(_promiseCapability_.[[Reject]], *undefined*, « a newly created *TypeError* object »). - 1. Return _promiseCapability_.[[Promise]]. 1. Let _moduleRequest_ be a new ModuleRequest Record { [[Specifier]]: _moduleSourceRecord_, [[Phase]]: _phase_, [[Attributes]]: « » }. 1. Perform HostLoadImportedModule(_referrer_, _moduleRequest_, ~empty~, _promiseCapability_). 1. Return _promiseCapability_.[[Promise]].