Delete unnecessary normalization logic from runtime library injection
The compiler already enforces that libraries are injected pre-typechecking. This implies they are injected pre-normalization.
@@ -3365,9 +3365,8 @@ public class Compiler extends AbstractCompiler implements ErrorHandler, SourceFi
return lastInjectedLibrary;
}
- if (hasTypeCheckingRun()) {
- throw new RuntimeException("runtime library injected after type checking:" + resourceName);
- }
+ checkState(!hasTypeCheckingRun(), "runtime library injected after type checking");
+ checkState(!getLifeCycleStage().isNormalized(), "runtime library injected after normalization");
// Load/parse the code.
String originalCode = ResourceLoader.loadTextResource(
@@ -3395,11 +3394,6 @@ public class Compiler extends AbstractCompiler implements ErrorHandler, SourceFi
ast.removeChild(node);
}
- // If we've already started optimizations, then we need to normalize this.
- if (getLifeCycleStage().isNormalized()) {
- Normalize.normalizeSyntheticCode(this, ast, "jscomp_" + resourceName + "_");
- }
-
// Insert the code immediately after the last-inserted runtime library.
Node lastChild = ast.getLastChild();
for (Node child = ast.getFirstChild(); child != null; child = child.getNext()) {
