Skip to content

Separate "force fulfill" operation from the CommitInstantiated #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ A <dfn>registry entry</dfn> is a record with the following fields:

<emu-alg>
1. If _entry_.[[Instantiate]] is *undefined*, then set _entry_.[[Instantiate]] to a new promise.
1. Return CommitInstantiated(_loader_, _entry_, _optionalInstance_, _source_).
1. CommitInstantiated(_loader_, _entry_, _optionalInstance_, _source_).
1. Fulfill _entry_.[[Instantiate]] with _entry_.
</emu-alg>

<h4 id="commit-instantiated" aoid="CommitInstantiated">CommitInstantiated(loader, entry, optionalInstance, source)</h4>
Expand All @@ -280,7 +281,6 @@ A <dfn>registry entry</dfn> is a record with the following fields:
1. Let _instance_ be Instantiation(_loader_, _optionalInstance_, _source_).
1. ReturnIfAbrupt(_instance_).
1. // TODO: edge case: what if _instance_ is a thenable function?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CommitInstantiated() is called from:

  • RequestInstantiate(), in which case the promise in [[Instantiate]] will be resolved implicitely, and there is not need to fulfilled manually.
  • FulfillInstantiate(), in which case the promise should be fulfillled manually with the provided value.

This change seems to be correct.

1. Fulfill _entry_.[[Instantiate]] with _instance_.
1. Let _deps_ be a new empty List.
1. If _instance_ is a Module Record, then:
1. Assert: _instance_ is a Source Text Module Record.
Expand Down