Skip to content

Commit 77a6e9c

Browse files
blicklycopybara-github
authored andcommitted
Move type removal to happen just after ambiguation
The only type-based optimizations that occur after ambiguation are inside PeepholeFoldConstants and PeepholeReplaceKnownMethods when run as part of the "late" peephole optmizations. Since these also run before ambiguation as part of the normal+early peephole passes, those type-based optimizations will have already had the opportunity to run, and thus removing the types from only the "late" version of this pass likely has negligible, if any, effect on code size. PiperOrigin-RevId: 321667491
1 parent 6963812 commit 77a6e9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,8 @@ protected List<PassFactory> getOptimizations() {
799799
passes.add(ambiguateProperties);
800800
}
801801

802+
passes.add(removeTypes);
803+
802804
if (options.propertyRenaming == PropertyRenamingPolicy.ALL_UNQUOTED) {
803805
passes.add(renameProperties);
804806
}
@@ -871,8 +873,6 @@ protected List<PassFactory> getOptimizations() {
871873
passes.add(latePeepholeOptimizations);
872874
}
873875

874-
passes.add(removeTypes);
875-
876876
if (options.anonymousFunctionNaming == AnonymousFunctionNamingPolicy.UNMAPPED) {
877877
passes.add(nameUnmappedAnonymousFunctions);
878878
}

0 commit comments

Comments
 (0)