aboutsummaryrefslogtreecommitdiff
path: root/src/delombok/lombok
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2023-02-18 23:04:51 +0100
committerRoel Spilker <r.spilker@gmail.com>2023-03-21 16:12:22 +0100
commit83c4dcfd5257975e9582be017bf66a7232cc2cbb (patch)
tree69b6d689b20d11ebb7f7cebeb05084a248a64046 /src/delombok/lombok
parente5c324c615c1e304b2a9a64bc7f8608a67b0a74e (diff)
downloadlombok-83c4dcfd5257975e9582be017bf66a7232cc2cbb.tar.gz
lombok-83c4dcfd5257975e9582be017bf66a7232cc2cbb.tar.bz2
lombok-83c4dcfd5257975e9582be017bf66a7232cc2cbb.zip
[jdk20] Updates support for record patterns
Diffstat (limited to 'src/delombok/lombok')
-rw-r--r--src/delombok/lombok/delombok/PrettyPrinter.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java
index 13836d77..b8b38da9 100644
--- a/src/delombok/lombok/delombok/PrettyPrinter.java
+++ b/src/delombok/lombok/delombok/PrettyPrinter.java
@@ -1253,7 +1253,14 @@ public class PrettyPrinter extends JCTree.Visitor {
@Override public void visitForeachLoop(JCEnhancedForLoop tree) {
aPrint("for (");
- printVarDefInline(tree.var);
+ JCTree varOrRecordPattern = readObject(tree, "varOrRecordPattern", null);
+ if (varOrRecordPattern instanceof JCVariableDecl) {
+ printVarDefInline((JCVariableDecl) varOrRecordPattern);
+ } else if (varOrRecordPattern != null) {
+ print(varOrRecordPattern);
+ } else {
+ printVarDefInline(tree.var);
+ }
print(" : ");
print(tree.expr);
print(") ");
@@ -1427,9 +1434,7 @@ public class PrettyPrinter extends JCTree.Visitor {
void printBindingPattern(JCTree tree) {
JCTree var = readObject(tree, "var", tree);
- print((JCExpression) readObject(var, "vartype", null));
- print(" ");
- print((Name) readObject(var, "name", null));
+ printVarDef0((JCVariableDecl) var);
}
void printDefaultCase(JCTree tree) {