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,