Weak imports allow specific named import bindings to be undefined when not resolved against the imported module.
A module
Module Environment Records support all of the declarative
Method | Purpose |
---|---|
CreateImportBinding(N, M, N2) |
Create an immutable indirect binding in a module |
CreateUndefinedWeakImportBinding(N) | Create an immutable unbound weak import binding representing an unresolved weak named import. |
GetThisBinding() |
Return the value of this this binding.
|
The behaviour of the additional concrete specification methods for module Environment Records are defined by the following algorithms:
The concrete
The InitializeEnvironment concrete method of a
This abstract method performs the following steps:
"ambiguous"
, throw a "*"
, then"ambiguous"
, throw a Field Name | Value Type | Meaning |
---|---|---|
[[ModuleRequest]] | String |
String value of the |
[[ImportName]] | String |
The name under which the desired binding is exported by the module identified by [[ModuleRequest]]. The value "*" indicates that the import request is for the target module's namespace object.
|
[[LocalName]] | String | The name that is used to locally access the imported value from within the importing module. |
[[Weak]] | Boolean | Boolean value indicating if the given import record corresponds to a weakly imported binding. |
Import Statement Form | [[ModuleRequest]] | [[ImportName]] | [[LocalName]] | [[Weak]] |
---|---|---|---|---|
import v from "mod";
|
"mod"
|
"default"
|
"v"
|
|
import * as ns from "mod";
|
"mod"
|
"*"
|
"ns"
|
|
import {x} from "mod";
|
"mod"
|
"x"
|
"x"
|
|
import {x as v} from "mod";
|
"mod"
|
"x"
|
"v"
|
|
import {weak x as v} from "mod";
|
"mod"
|
"x"
|
"v"
|
|
import "mod";
|
An ImportEntry |
With parameter module.
"default"
, [[LocalName]]: localName, [[Weak]]: "*"
, [[LocalName]]: localName, [[Weak]]: