Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 1e4c2b4

Browse files
committed
Move documentation of linking-specific intrinsics to linking.js.
1 parent a640b10 commit 1e4c2b4

File tree

2 files changed

+51
-47
lines changed

2 files changed

+51
-47
lines changed

Loader.js

+2-47
Original file line numberDiff line numberDiff line change
@@ -223,51 +223,6 @@ function $SetDependencies(module, deps) {
223223
GetModuleInternalData(module).dependencies = deps;
224224
}
225225

226-
// * `$DefineConstant(module, name, value)` defines a constant binding in the
227-
// toplevel declarative environment of `module`, with the given `name` and
228-
// `value`. This is only used to implement `module a from "A";`
229-
// declarations, so `value` is always a Module object.
230-
//
231-
// * `$CreateImportBinding(module, name, export)` defines an import binding.
232-
// `module` is the importing module. `name` is a string, the name of the
233-
// local binding being bound. `export` is a value returned by
234-
// $GetModuleExport(), representing the location of the slot to be bound.
235-
//
236-
// The effect of `$CreateImportBinding` is that in `module`'s scope, `name`
237-
// becomes an alias for the binding indicated by `export`.
238-
//
239-
// `name` must in fact be a name declared by an import declaration in
240-
// `module`, and it must not already have been bound.
241-
//
242-
// * `$ModuleBodyToModuleObject(body)` returns a `Module` object for the
243-
// given ModuleBody `body`.
244-
//
245-
// Modules declared in scripts must be linked and evaluated before they are
246-
// exposed to user code.
247-
//
248-
// * `$GetModuleBody(mod)` returns `mod.[[Body]]`. This is the parse of the
249-
// module source code, if the Module object `mod` was compiled from JS
250-
// source, and undefined otherwise.
251-
//
252-
// * `$GetModuleExport(mod, name)` returns information about an export
253-
// binding. If the module `mod` has an export binding for the given
254-
// `name`, return an opaque object representing the slot it's bound to.
255-
// The only operations on this object are $IsExportImplicit and
256-
// $LinkPassThroughExport. Otherwise return undefined.
257-
//
258-
// * `$IsExportImplicit(export)` returns true if `export` arises from a
259-
// declaration of the form `export *;` and false otherwise.
260-
//
261-
// * `$GetModuleExports(mod)` returns a new array containing the names of the
262-
// export bindings already defined in the module `mod`.
263-
//
264-
// * `$LinkPassThroughExport(mod, name, origin)` creates an export binding on
265-
// the module `mod` with the given `name`, bound to `origin`.
266-
//
267-
// * `$UnlinkModule(mod)` unlinks the given module. This removes all export
268-
// bindings and import bindings from the module. The module may be re-linked
269-
// later.
270-
//
271226
// * `$EvaluateModuleBody(realm, mod)` runs the body of the given module in
272227
// the context of a given realm. Returns undefined.
273228
//
@@ -2096,8 +2051,8 @@ def(Loader.prototype, {
20962051
// **The Module type check in set()** – If the module argument is not
20972052
// actually a Module instance object, `set` fails. This enforces an
20982053
// invariant of the module registry: all the values are `Module`
2099-
// instances. *Rationale:* We use `Module`-specific intrinsics on them,
2100-
// particularly `$GetModuleExport`.
2054+
// instances. *Rationale:* We use `Module`-specific operations on them,
2055+
// particularly for linking and evaluation.
21012056
//
21022057
// **set() and already-linked modules** – If there is already a
21032058
// module in the registry with the given full name, `set` replaces it, but

linking.js

+49
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,55 @@
55
// (that is, non-default instantiate hooks).
66

77

8+
// Primitives required by this code:
9+
//
10+
// * `$DefineConstant(module, name, value)` defines a constant binding in the
11+
// toplevel declarative environment of `module`, with the given `name` and
12+
// `value`. This is only used to implement `module a from "A";`
13+
// declarations, so `value` is always a Module object.
14+
//
15+
// * `$CreateImportBinding(module, name, export)` defines an import binding.
16+
// `module` is the importing module. `name` is a string, the name of the
17+
// local binding being bound. `export` is a value returned by
18+
// $GetModuleExport(), representing the location of the slot to be bound.
19+
//
20+
// The effect of `$CreateImportBinding` is that in `module`'s scope, `name`
21+
// becomes an alias for the binding indicated by `export`.
22+
//
23+
// `name` must in fact be a name declared by an import declaration in
24+
// `module`, and it must not already have been bound.
25+
//
26+
// * `$ModuleBodyToModuleObject(body)` returns a `Module` object for the
27+
// given ModuleBody `body`.
28+
//
29+
// Modules declared in scripts must be linked and evaluated before they are
30+
// exposed to user code.
31+
//
32+
// * `$GetModuleBody(mod)` returns `mod.[[Body]]`. This is the parse of the
33+
// module source code, if the Module object `mod` was compiled from JS
34+
// source, and undefined otherwise.
35+
//
36+
// * `$GetModuleExport(mod, name)` returns information about an export
37+
// binding. If the module `mod` has an export binding for the given
38+
// `name`, return an opaque object representing the slot it's bound to.
39+
// The only operations on this object are $IsExportImplicit and
40+
// $LinkPassThroughExport. Otherwise return undefined.
41+
//
42+
// * `$IsExportImplicit(export)` returns true if `export` arises from a
43+
// declaration of the form `export *;` and false otherwise.
44+
//
45+
// * `$GetModuleExports(mod)` returns a new array containing the names of the
46+
// export bindings already defined in the module `mod`.
47+
//
48+
// * `$LinkPassThroughExport(mod, name, origin)` creates an export binding on
49+
// the module `mod` with the given `name`, bound to `origin`.
50+
//
51+
// * `$UnlinkModule(mod)` unlinks the given module. This removes all export
52+
// bindings and import bindings from the module. The module may be re-linked
53+
// later.
54+
//
55+
56+
857

958
var std_SyntaxError = SyntaxError;
1059
var std_ReferenceError = ReferenceError;

0 commit comments

Comments
 (0)