Skip to content

Commit e018620

Browse files
committed
implementation feedback from issue whatwg#24 - first pass
1 parent 819035f commit e018620

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

index.bs

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -236,23 +236,23 @@ A <dfn>registry entry</dfn> is a record with the following fields:
236236

237237
<pre emu-alg>
238238
1. If _entry_.[[Instantiate]] is *undefined*, then set _entry_.[[Instantiate]] to a new promise.
239-
1. Return CommitInstantiated(_entry_, _instance_, _source_).
239+
1. Return CommitInstantiated(_loader_, _entry_, _instance_, _source_).
240240
</pre>
241241

242-
<h4 id="commit-instantiated">CommitInstantiated(entry, instance, source)</h4>
242+
<h4 id="commit-instantiated">CommitInstantiated(loader, entry, instance, source)</h4>
243243

244244
<pre emu-alg>
245-
1. Let _instance_ be Instantiation(_instance_, _source_).
246-
1. ReturnIfAbrupt(_instance_).
247-
1. // TODO: edge case: what if _instance_ is a thenable function?
248-
1. Resolve _entry_.[[Instantiate]] with _instance_.
245+
1. Let _module_ be Instantiation(_loader_, _instance_, _source_).
246+
1. ReturnIfAbrupt(_module_).
247+
1. // TODO: edge case: what if _module_ is a thenable function?
248+
1. Resolve _entry_.[[Instantiate]] with _module_.
249249
1. Let _deps_ be a new empty List.
250-
1. If _instance_ is a Module Record, then:
251-
1. Assert: _instance_ is a Normal Module Record.
252-
1. For each _dep_ in _instance_.[[ImportedModules]], do:
250+
1. If _module_ is a Module Record, then:
251+
1. Assert: _module_ is a Normal Module Record.
252+
1. For each _dep_ in _module_.[[ImportedModules]], do:
253253
1. Append the record { [[key]]: _dep_, [[value]]: *undefined* } to _deps_.
254254
1. Set _entry_.[[Dependencies]] to _deps_.
255-
1. Set _entry_.[[Module]] to _instance_.
255+
1. Set _entry_.[[Module]] to _module_.
256256
1. Set _entry_.[[State]] to the max of _entry_.[[State]] and "link".
257257
</pre>
258258

@@ -275,9 +275,9 @@ A <dfn>registry entry</dfn> is a record with the following fields:
275275
1. Let _hook_ be _loader_.[[Fetch]].
276276
1. // TODO: metadata object
277277
1. Let _p0_ be the result of promise-calling _hook_(_key_).
278-
1. Let _p_ be the result of transforming _p0_ with a fulfillment handler that, when called with argument _v_, runs the following steps:
278+
1. Let _p_ be the result of transforming _p0_ with a fulfillment handler that, when called with argument _payload_, runs the following steps:
279279
1. Set _entry_.[[State]] to the max of _entry_.[[State]] and "translate".
280-
1. Return _v_.
280+
1. Return _payload_.
281281
1. Set _entry_.[[Fetch]] to _p_.
282282
1. Return _p_.
283283
</pre>
@@ -306,27 +306,31 @@ A <dfn>registry entry</dfn> is a record with the following fields:
306306
1. If _entry_.[[State]] is "ready", return a new error promise.
307307
1. If _entry_.[[Instantiate]] is not *undefined*, return _entry_.[[Instantiate]].
308308
1. Let _hook_ be _loader_.[[Instantiate]].
309-
1. Let _p_ be the result of transforming RequestFetch(_loader_, _key_) with a fulfillment handler that, when called with argument _payload_, runs the following steps:
310-
1. Return the result of transforming RequestTranslate(_loader_, _key_) with a fulfillment handler that, when called with argument _source_, runs the following steps:
311-
1. // TODO: metadata
312-
1. Let _p1_ be the result of promise-calling _hook_(_key_, _payload_, _source_).
313-
1. Return the result of transforming _p1_ with a fulfillment handler that, when called with argument _instance_, runs the following steps:
314-
1. Let _status_ be CommitInstantiated(_entry_, _instance_, _source_).
315-
1. ReturnIfAbrupt(_status_).
316-
1. Return _entry_.
309+
1. Let _p_ be the result of transforming RequestTranslate(_loader_, _key_) with a fulfillment handler that, when called with argument _source_, runs the following steps:
310+
1. // TODO: metadata
311+
1. Let _p1_ be the result of promise-calling _hook_(_key_, _payload_, _source_).
312+
1. Return the result of transforming _p1_ with a fulfillment handler that, when called with argument _instance_, runs the following steps:
313+
1. Let _status_ be CommitInstantiated(_loader_, _entry_, _instance_, _source_).
314+
1. ReturnIfAbrupt(_status_).
315+
1. Return _entry_.
317316
1. Set _entry_.[[Instantiate]] to _p_.
318317
1. Return _p_.
319318
</pre>
320319

321320
<h4 id="request-link">RequestLink(loader, key)</h4>
322321

323322
<pre emu-alg>
324-
1. Let _entry0_ be EnsureRegistered(_loader_, _key_).
325-
1. If _entry0_.[[State]] is "ready", return a new promise fulfilled with _entry_.[[Module]].
323+
1. Let _entry_ be EnsureRegistered(_loader_, _key_).
324+
1. If _entry_.[[State]] is "ready", return a new promise fulfilled with _entry_.[[Module]].
326325
1. Return the result of transforming RequestInstantiate(_loader_, _key_) with a fulfillment handler that, when called with argument _entry_, runs the following steps:
327326
1. Let _depLoads_ be a new empty List.
328327
1. For each _pair_ in _entry_.[[Dependencies]], do:
329328
1. Let _p_ be the result of transforming Resolve(_loader_, _pair_.[[key]], _key_) with a fulfillment handler that, when called with value _depKey_, runs the following steps:
329+
1. Let _depEntry_ be EnsureRegistered(_loader_, _depKey_).
330+
1. If _depEntry_.[[State]] is "ready", then:
331+
1. Let _dep_ be _depEntry_.[[Module]].
332+
1. Set _pair_.[[value]] to _dep_.
333+
1. Return _dep_.
330334
1. Return the result of transforming RequestInstantiate(_loader_, _depKey_) with a fulfillment handler that, when called with value _dep_, runs the following steps:
331335
1. Set _pair_.[[value]] to _dep_.
332336
1. Return _dep_.
@@ -501,7 +505,7 @@ The modules spec should only invoke this operation from methods of Normal Module
501505
<h4 id="reflect-loader-error">Reflect.Loader.error(key, stage, value)</h4>
502506

503507
<pre emu-alg>
504-
1.
508+
1.
505509
</pre>
506510

507511

@@ -553,7 +557,7 @@ The modules spec should only invoke this operation from methods of Normal Module
553557
1. Append { [[key]]: _key_, [[value]]: _entry_ } to _loader_.[[Registry]].
554558
</pre>
555559

556-
<h4 id="reflect-loader-uninstall">Reflect.Loader.uninstall(module)</h4>
560+
<h4 id="reflect-loader-uninstall">Reflect.Loader.uninstall(key)</h4>
557561

558562
<pre emu-alg>
559563
1. Let _loader_ be *this* value.
@@ -597,7 +601,7 @@ The modules spec should only invoke this operation from methods of Normal Module
597601

598602
<h4 id="reflective-module-record">Reflective Module Records</h4>
599603

600-
A <dfn>reflective module record</dfn> is a kind of module record. It extends
604+
A <dfn>reflective module record</dfn> is a kind of module record. It extends
601605

602606
<table>
603607
<thead>

0 commit comments

Comments
 (0)