Skip to content

Commit

Permalink
revised GuardedPattern
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMOBrien committed Feb 22, 2024
1 parent 76770b7 commit 4232e26
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/java/boa/datagen/util/JavaVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2597,9 +2597,19 @@ public boolean visit(final GuardedPattern node) {

final boa.types.Ast.Expression.Builder eb = boa.types.Ast.Expression.newBuilder();
eb.setKind(boa.types.Ast.Expression.ExpressionKind.GUARDED_PATTERN);
eb.addExpressions(expressions.pop());
node.getPattern().accept(this);
eb.addExpressions(expressions.pop());
Expression expression = node.getExpression();
Pattern pattern = node.getPattern();

if (expression != null) {
expression.accept(this);
eb.addExpressions(expressions.pop());
}

if (pattern != null) {
pattern.accept(this);
eb.addExpressions(expressions.pop());
}

expressions.push(eb.build());

return false;
Expand Down

0 comments on commit 4232e26

Please sign in to comment.