Skip to content

Commit 1700e3c

Browse files
committed
Remove Pattern Matching
1 parent 89c626a commit 1700e3c

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

liquidjava-verifier/pom.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,6 @@
9595
</execution>
9696
</executions>
9797
</plugin>
98-
<plugin>
99-
<groupId>org.apache.maven.plugins</groupId>
100-
<artifactId>maven-compiler-plugin</artifactId>
101-
<version>3.11.0</version>
102-
<configuration>
103-
<release>24</release>
104-
<compilerArgs>
105-
<arg>--enable-preview</arg>
106-
</compilerArgs>
107-
</configuration>
108-
</plugin>
10998
</plugins>
11099
</build>
111100

liquidjava-verifier/src/main/java/liquidjava/rj_language/ast/Expression.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,24 @@ public boolean isLiteral() {
5353

5454
/**
5555
* Checks if this expression produces a boolean type based on its structure
56+
*
5657
* @return true if it is a boolean expression, false otherwise
5758
*/
5859
public boolean isBooleanExpression() {
59-
return switch (this) {
60-
case LiteralBoolean _, Ite _, AliasInvocation _, FunctionInvocation _ -> true;
61-
case GroupExpression ge -> ge.getExpression().isBooleanExpression();
62-
case BinaryExpression be -> be.isBooleanOperation() || be.isLogicOperation();
63-
case UnaryExpression ue -> ue.getOp().equals("!");
64-
default -> false;
65-
};
60+
if (this instanceof LiteralBoolean || this instanceof Ite || this instanceof AliasInvocation
61+
|| this instanceof FunctionInvocation) {
62+
return true;
63+
}
64+
if (this instanceof GroupExpression ge) {
65+
return ge.getExpression().isBooleanExpression();
66+
}
67+
if (this instanceof BinaryExpression be) {
68+
return be.isBooleanOperation() || be.isLogicOperation();
69+
}
70+
if (this instanceof UnaryExpression ue) {
71+
return ue.getOp().equals("!");
72+
}
73+
return false;
6674
}
6775

6876
/**

0 commit comments

Comments
 (0)