processDefines FeatureSet ES8_MODULES -> TYPE_CHECK_SUPPORTED
In checks-only mode processDefines runs during the checks phase
instead of the optimizations phase, so it needs to understand all the features
used there.
Fortunately ProcessDefines is pretty simple.
It won't even notice the new features in TYPE_CHECK_SUPPORTED that aren't in
ES8_MODULES.
@@ -2113,7 +2113,8 @@ public final class DefaultPassConfig extends PassConfig {
};
/** Override @define-annotated constants. */
- private final PassFactory processDefines = new PassFactory("processDefines", true) {
+ private final PassFactory processDefines =
+ new PassFactory("processDefines", true) {
@Override
protected CompilerPass create(final AbstractCompiler compiler) {
return new CompilerPass() {
@@ -2124,14 +2125,15 @@ public final class DefaultPassConfig extends PassConfig {
replacements.putAll(getAdditionalReplacements(options));
replacements.putAll(options.getDefineReplacements());
new ProcessDefines(compiler, ImmutableMap.copyOf(replacements), !options.checksOnly)
- .injectNamespace(namespaceForChecks).process(externs, jsRoot);
+ .injectNamespace(namespaceForChecks)
+ .process(externs, jsRoot);
}
};
}
@Override
public FeatureSet featureSet() {
- return ES8_MODULES;
+ return TYPE_CHECK_SUPPORTED;
}
};
