|
|
|
5. Let env realm .[[GlobalEnv]]). 6. Set module .[[Environment]] to env . 7. For each in of module .[[ImportEntries]], do a. Let importedModule ( module , in .[[ModuleRequest]]). b. NOTE: The above call cannot fail because imported module requests are a subset of module . [[RequestedModules]], and these have been resolved earlier in this algorithm. c. If in .[[ImportName]] is "*" , then i. Let namespace be ? importedModule ). ii. Perform ! env .CreateImmutableBinding( in .[[LocalName]], true ). iii. Call env .InitializeBinding( in .[[LocalName]], namespace ). d. Else, i. Let resolution be ? importedModule .ResolveExport( in .[[ImportName]]). ii. If resolution is null or "ambiguous" , throw a SyntaxError exception. iii. If resolution .[[BindingName]] is "*namespace*" , then 1. Let namespace be ? resolution .[[Module]]). 2. Perform ! env .CreateImmutableBinding( in .[[LocalName]], true ). 3. Call env .InitializeBinding( in .[[LocalName]], namespace ). iv. Else, 1. Call env .CreateImportBinding( in .[[LocalName]], resolution .[[Module]], resolution . [[BindingName]]). 8. Let moduleContext 9. Set the Function of moduleContext to null . 10. : module .[[Realm]] is not undefined . 11. Set the of moduleContext to module .[[Realm]]. 12. Set the ScriptOrModule of moduleContext to module . 13. Set the VariableEnvironment of moduleContext to module .[[Environment]]. 14. Set the LexicalEnvironment of moduleContext to module .[[Environment]]. 15. Set module .[[Context]] to moduleContext . 16. Push moduleContext moduleContext is now the . 17. Let code be module .[[ECMAScriptCode]]. 18. Let varDeclarations code . 19. Let declaredVarNames be a new empty 20. For each element d of varDeclarations , do a. For each element dn of the of d , do i. If dn is not an element of declaredVarNames , then 1. Perform ! env .CreateMutableBinding( dn , false ). 2. Call env .InitializeBinding( dn , undefined ). 3. Append dn to declaredVarNames . 21. Let lexDeclarations be the of code . 22. For each element d of lexDeclarations , do a. For each element dn of the of d , do i. If d is true , then 1. Perform ! env .CreateImmutableBinding( dn , true ). ii. Else, 1. Perform ! env .CreateMutableBinding( dn , false ). iii. If d is a , a , or an , then 1. Let fo of d with argument env . 448 |