From f225718a3c1887ded0f909fd1525f357706d9a81 Mon Sep 17 00:00:00 2001 From: Ghislain Fourny Date: Wed, 31 Jul 2024 15:36:51 +0200 Subject: [PATCH] Fix tests. --- .../ExpressionClassificationVisitor.java | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/rumbledb/compiler/ExpressionClassificationVisitor.java b/src/main/java/org/rumbledb/compiler/ExpressionClassificationVisitor.java index a9ad6c47c..946772fb2 100644 --- a/src/main/java/org/rumbledb/compiler/ExpressionClassificationVisitor.java +++ b/src/main/java/org/rumbledb/compiler/ExpressionClassificationVisitor.java @@ -58,14 +58,6 @@ protected ExpressionClassification defaultAction(Node node, ExpressionClassifica return expressionClassification; } - if (node instanceof StatementsAndExpr) { - ((StatementsAndExpr) node).setExpressionClassification(expressionClassification); - return expressionClassification; - } - if (node instanceof StatementsAndOptionalExpr) { - ((StatementsAndOptionalExpr) node).setExpressionClassification(expressionClassification); - return expressionClassification; - } if (node instanceof InlineFunctionExpression) { ((InlineFunctionExpression) node).setExpressionClassification(expressionClassification); return expressionClassification; @@ -95,6 +87,28 @@ public ExpressionClassification visitDescendants(Node node, ExpressionClassifica return result; } + @Override + public ExpressionClassification visitStatementsAndOptionalExpr( + StatementsAndOptionalExpr expression, + ExpressionClassification argument + ) { + this.visitDescendants(expression, argument); + Expression e = expression.getExpression(); + expression.setExpressionClassification(e.getExpressionClassification()); + return e.getExpressionClassification(); + } + + @Override + public ExpressionClassification visitStatementsAndExpr( + StatementsAndExpr expression, + ExpressionClassification argument + ) { + this.visitDescendants(expression, argument); + Expression e = expression.getExpression(); + expression.setExpressionClassification(e.getExpressionClassification()); + return e.getExpressionClassification(); + } + @Override public ExpressionClassification visitCommaExpression( CommaExpression expression,