Skip to content

Commit b539914

Browse files
lauraharkercopybara-github
authored andcommittedMar 25, 2024·
Always run ProcessClosurePrimitives before module rewriting
Only affects builds enabling the legacy "rewrite modules before typechecking" mode. I don't expect this to be a breaking change. Reasoning: we eventually want module rewriting to run post-typechecking for every build, but ProcessClosurePrimitives will still need to run pre-typechecking. This change gets us closer to that ideal pass ordering. PiperOrigin-RevId: 618922256
1 parent 0715ade commit b539914

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎src/com/google/javascript/jscomp/DefaultPassConfig.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ protected PassListBuilder getChecks() {
234234
checks.maybeAdd(checkSideEffects);
235235
checks.maybeAdd(angularPass);
236236
checks.maybeAdd(closureGoogScopeAliases);
237-
addModuleRewritingPasses(checks, options);
238237
checks.maybeAdd(closurePrimitives);
238+
addModuleRewritingPasses(checks, options);
239239
checks.maybeAdd(clearTypedScopeCreatorPass);
240240
checks.maybeAdd(clearTopTypedScopePass);
241241
checks.maybeAdd(generateExports);
@@ -344,15 +344,15 @@ protected PassListBuilder getChecks() {
344344
checks.maybeAdd(closureGoogScopeAliases);
345345
}
346346

347+
if (options.closurePass) {
348+
checks.maybeAdd(closurePrimitives);
349+
}
350+
347351
// TODO(b/141389184): Move this after the Polymer pass
348352
if (options.shouldRewriteModulesBeforeTypechecking()) {
349353
addModuleRewritingPasses(checks, options);
350354
}
351355

352-
if (options.closurePass) {
353-
checks.maybeAdd(closurePrimitives);
354-
}
355-
356356
// It's important that the PolymerPass run *after* the ClosurePrimitives and ChromePass rewrites
357357
// and *before* the suspicious code checks. This is enforced in the assertValidOrder method.
358358
if (options.polymerVersion != null) {

0 commit comments

Comments
 (0)
Please sign in to comment.