The parsing of modules is currently open-coded in the middle of ParseModuleAndImports. It should be its own stand-alone ParseModule operation. (It should construct a Normal Module Record per bug 3747 and initialize the [[Realm]] property per bug 3746.)
See https://gist.github.com/dherman/cad85565e0eb16d0a22d for details.
Dave
Wouldn't it be better to make the setting of the Module Rcord [[Realm]] a separate step of TopLevelModuleEvaluationJob (or other clients) rather than making it a parameter of of ParseModule?
There aren't any other other dependencies upon the Realm in ParseModule and I can imagine that other specifications might want to parse a module prior to having a realm to associate it with.
> Wouldn't it be better to make the setting of the Module Rcord [[Realm]] a
> separate step of TopLevelModuleEvaluationJob (or other clients) rather than
> making it a parameter of of ParseModule?
Either way works fine for me. The loader spec needs to set the [[Realm]] property after parsing but it can do this imperatively.
Dave
fixed in rev34 editor's draft
fixed in rev34