google / google/closure-compiler
Consider moving PassFactory instances into static fields on the passes themselves
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Currently the bottom 2/3 of `DefaultPassConfig` is a bunch of `PassFactory` instances. Previously these were very trivial, but they are getting more significant now that things like `featureSet` or `transpiledFeatures` are getting added.
To keep them better in-sync with the actual passes, it seems to make sense to move the factories to the passes themselves. So for instance, we would write
```java
class CheckRequires implements HotSwapCompilerPass {
// ...
static final HotSwapPassFactory FACTORY =
new HotSwapPassFactory("checkMissingAndExtraRequires") {
// ...
};
}
```
and then in `DefaultPassConfig` it would just be
```java
checks.add(CheckRequires.FACTORY);
```
Is there a reason we shouldn't do this?
Contributor guide
Assessment
This issue has not been assessed yet.