Editorial: Move module TopLevelCapability check inside if #3742
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current spec:

Proposed spec:

In the current spec, the condition in step 4 can only be true if the condition in step 3 was true. Moving step 4 as a sub-step of step 3 makes it clearer, without the next reader having to wonder how we can hit the control flow path with 3 false and 4 true.
Proof:
For convenience, I'm going to call module the value that the module variable has starting from step 3.a.i/4, and originalModule the "this value" of the Evaluate() concrete method. module is either originalModule or its [[CycleRoot]].
If 4 is true, it's because module already went through step 7 of Evaluate(), since that's the only place where [[TopLevelCapability]] is set. This means that module.[[Status]] is either already
~evaluated~(asserted in steps 9.b and 10.a) or (~evaluating-async~).originalModule was in that previous call either module itself, or part of a cycle containing both. A cycle transitions to
~evaluated~/~evaluating-async~atomically (steps 16.b.v and 16.b.vi of InnerModuleEvaluation), which means that originalModule is also eitherevaluatedorevaluating-async.Thus if 4 is true, 3 must have been true.