Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editorial: refactor classic and module scripts to be more alike
This makes "create a classic script" work the same as "create a module script". Both now parse source text into the appropriate record (viz. Script Record or Source Text Module Record), storing the result, or any parse error, for later use by "run a X script". As a consequence, this expands the base "script" struct to include "record" and "parse error" fields, which were previously module-specific. In general, this alignment will help greatly when working on dynamic import(), which per https://github.com/tc39/proposal-dynamic-import/blob/23cf15a8ccef0c7174b504b33fb6b2b9be1ebecd/HTML%20Integration.md will move more things into the shared base struct. Note that for now, "parse error" is somewhat of a misnomer for modules, as we propagate dependency errors into this field. This is hinted at by leaving the name for that algorithm, "set a pre-instantiation error", intact. We anticipate clearing up this confusion in subsequent commits, by changing error propagation, but this was left as such in order to keep this commit purely editorial. Along the way, this: * Fixes a few remaining references to module trees, as opposed to module graphs. * Changes "muted errors" from a flag into a boolean. * Modernizes the algorithm style for both create algorithms, making them take named parameters, stop using goto-style jumps, and use booleans instead of flags. * Fixes the spec to report errors while inside the "prepare to run a script" / "clean up after running script" block. * Fixes several wrong variable references within these algorithms.
- Loading branch information