fix identifiermovement bug

This commit is contained in:
ChUrl
2020-12-14 17:29:23 +01:00
parent d0d0426345
commit 29def0a645

View File

@ -224,6 +224,7 @@ public final class ASTCompacter {
root.getChildren().remove(op); root.getChildren().remove(op);
} }
// Jede Expression hat maximal 1x Operator
private static ASTNode getOp(ASTNode root) { private static ASTNode getOp(ASTNode root) {
for (ASTNode child : root.getChildren()) { for (ASTNode child : root.getChildren()) {
ASTNode op = switch (child.getName()) { ASTNode op = switch (child.getName()) {
@ -263,13 +264,16 @@ public final class ASTCompacter {
root.getChildren().remove(id); root.getChildren().remove(id);
} }
// Assignments koennen >1 Identifier haben: Wenn ja, nimm den 2.
private static ASTNode getId(ASTNode root) { private static ASTNode getId(ASTNode root) {
ASTNode childOut = null;
for (ASTNode child : root.getChildren()) { for (ASTNode child : root.getChildren()) {
if (child.getName().equals("IDENTIFIER")) { if ("IDENTIFIER".equals(child.getName())) {
return child; childOut = child;
} }
} }
return null; return childOut;
} }
} }