15.2.1.17 Runtime Semantics: HostResolveImportedModule (referencingModule, specifier )
The concrete module instance returned by HostResolveImportedModule must already have been instantiated, but this requirement is not listed in 15.2.1.17.
What do yo mean? That it's ModuleDeclarationInstantiation method has already been called? but that's not an actualrequirement
For example in 15.2.1.16.5 ModuleEvaluation() Concrete Method:
Step 5.a calls requiredModule = HostResolveImportedModule and step 5.c calls requiredModule.ModuleEvaluation(). But calling ModuleEvaluation() is only valid when requiredModule was previously instantiated through ModuleDeclarationInstantiation().
should more like a precondition on ModuleEvaluation rather than a requirement of HostResolveImportedModule
Not only for 15.2.1.16.5 ModuleEvaluation, it's also required in 15.2.1.16.4 ModuleDeclarationInstantiation( ) step 10.a for this example:
m1.js (main module)
---
import {} from "./m2.js";
import* as mod3 from "./m3.js";
export {mod3};
---
m2.js
---
print(mod1.mod3.foo); // <- Expected: ReferenceError at runtime
import* as mod1 from "./m1.js";
---
m3.js
---
export let foo = "hello world";
---
m1.js is the main module and parsed by TopLevelModuleEvaluationJob. When the line `print(mod1.mod3.foo)` gets executed, it's necessary that ModuleDeclarationInstantiation for m3.js was already performed to ensure targetModule.[[Environment]] in 9.4.6.8 [[Get]] is not undefined.
Hmm.. required modules aren't being recursively instantiated. that used to happen in LinkModules before it went awayu
fixed in rev34 editor's draft
ModuleDeclrationInstantion for source text module records recursively instantiates the modules on its [[RequestedModules]] list
fixed in rev34