use of com.github.anba.es6draft.runtime.modules.ModuleSemantics.HostResolveImportedModule in project es6draft by anba.
the class SourceTextModuleRecord method instantiate.
/**
* 15.2.1.16.4 ModuleDeclarationInstantiation( ) Concrete Method
*/
@Override
public void instantiate() throws IOException, MalformedNameException, ResolutionException {
/* step 1 */
SourceTextModuleRecord module = this;
/* step 2 */
Realm realm = module.realm;
/* step 3 */
assert realm != null : "module is not linked";
/* step 4 */
Module code = module.scriptCode;
/* step 5 */
if (module.environment != null) {
return;
}
/* step 6 */
LexicalEnvironment<ModuleEnvironmentRecord> env = newModuleEnvironment(realm.getGlobalEnv());
/* step 7 */
module.environment = env;
/* step 8 */
for (String required : module.requestedModules) {
/* step 8.a (note) */
/* steps 8.b-c */
ModuleRecord requiredModule = HostResolveImportedModule(module, required);
/* steps 8.d-e */
requiredModule.instantiate();
}
/* steps 9-17 */
ExecutionContext context = newModuleDeclarationExecutionContext(realm, code);
code.getModuleBody().moduleDeclarationInstantiation(context, this, env);
module.instantiated = true;
}
Aggregations