aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/replaymod/gradle/remap/PsiPattern.kt
AgeCommit message (Collapse)Author
2022-05-27Fix pattern applying non-field to left side of assignmentJonas Herzig
2022-05-27Fix nested pattern matchingJonas Herzig
2022-05-27Support matching lambda expressions with @PatternJonas Herzig
2022-05-27Support matching binary expressions with @PatternJonas Herzig
2022-05-27Support varargs as parameters to @PatternJonas Herzig
2022-05-27Properly support new expression matching in @PatternJonas Herzig
Used to only compare the arguments, nether the class nor the qualifier (the outer class instance for inner classes constructor calls).
2022-05-24Support matching literal with @PatternJonas Herzig
2021-03-14Add new @Pattern feature to centralize version-aware codeJonas Herzig
That is, most of the business code should not be aware that it is being compiled to multiple versions even when it heavily interacts with MC, preprocessor statements should be an escape hatch, not the norm. Similarly, code should not be forced to do `MCVer.getWindow(mc)` instead of the much more intuitive `mc.getWindow()`, and this new preprocessor (technically remap) feature makes this possible by defining "search and replace"-like patterns (but smarter in that they are type-aware) in one or more central places which then are applied all over the code base. In a way, this is another step in the automatic back-porting process where preprocessor statements are used when we cannot yet do something automatically. Previously we "merely" automatically converted between different mapping, this new feature now also allows us to automatically perform simple refactoring tasks like changing field access to a getter+setter (e.g. `mc.getWindow()`), or changing how a method is called (e.g. `BufferBuilder.begin`), or changing a method call chain (e.g. `dispatcher.camera.getYaw()`), or most other search-and-replace-like changes and any combination of those. The only major limitation is that the replacement itself is not smart, so arguments must be kept in same order (or be temporarily assigned to local variables which then can be used in any order).