Closed nicolo-ribaudo closed 2 years ago
The evaluating state is always supposed to synchronously transition - that is it should never be observable outside of any one top-level evaluation call.
The bug with the current spec in this repo is that it calls import("b")
->b.Link()
synchronously if HostLoadImportedModule
returns synchronously, and at that time "b"
's status is evaluating
. There hasn't been a promise tick yet since when main.Evaluate()
was called.
I can fix this by always waiting a tick before .Link()
even if the module was already loaded.
That sounds correct to me.
https://nicolo-ribaudo.github.io/modules-import-hooks-refactor/#sec-moduledeclarationlinking
With these three files:
When calling
main.Evaluate()
:main
,a
andb
transitions toevaluating
import("b")
synchronously callsb.Link()
, butb
's status isevaluating