VisitLogicalBinary visits the node
(ctx *antlrgen.LogicalBinaryContext)
| 658 | |
| 659 | // VisitLogicalBinary visits the node |
| 660 | func (v *ASTBuilder) VisitLogicalBinary(ctx *antlrgen.LogicalBinaryContext) interface{} { |
| 661 | location := v.getLocation(ctx) |
| 662 | if v.SQL2AqlCtx.exprCheck { |
| 663 | v.Logger.Debugf("VisitLogicalBinary check: %s", ctx.GetText()) |
| 664 | if ctx.GetOperator() == nil { |
| 665 | panic(fmt.Errorf("missing logicalBinary operator, (line:%d, col:%d)", |
| 666 | location.Line, location.CharPosition)) |
| 667 | } |
| 668 | |
| 669 | v.Visit(ctx.GetLeft()) |
| 670 | v.Visit(ctx.GetRight()) |
| 671 | return tree.NewExpression(v.getLocation(ctx)) |
| 672 | } |
| 673 | |
| 674 | v.Logger.Debugf("VisitLogicalBinary: %s", ctx.GetText()) |
| 675 | operator := v.getLogicalBinaryOperator(ctx.GetOperator().GetTokenType()) |
| 676 | if operator == tree.OR { |
| 677 | if v.SQL2AqlCtx.exprOrigin == ExprOriginWhere { |
| 678 | v.SQL2AqlCtx.MapRowFilters[v.SQL2AqlCtx.mapKey] = |
| 679 | append(v.SQL2AqlCtx.MapRowFilters[v.SQL2AqlCtx.mapKey], v.getText(ctx.BaseParserRuleContext)) |
| 680 | } else if v.SQL2AqlCtx.exprOrigin == ExprOriginJoinOn { |
| 681 | last := len(v.SQL2AqlCtx.MapJoinTables[v.SQL2AqlCtx.mapKey]) - 1 |
| 682 | v.SQL2AqlCtx.MapJoinTables[v.SQL2AqlCtx.mapKey][last].Conditions = |
| 683 | append(v.SQL2AqlCtx.MapJoinTables[v.SQL2AqlCtx.mapKey][last].Conditions, v.getText(ctx.BaseParserRuleContext)) |
| 684 | } |
| 685 | |
| 686 | expr := tree.NewExpression(v.getLocation(ctx)) |
| 687 | expr.SetValue(fmt.Sprintf("LogicalBinaryExpression: (%s)", v.getText(ctx.BaseParserRuleContext))) |
| 688 | return expr |
| 689 | } |
| 690 | |
| 691 | left, _ := v.Visit(ctx.GetLeft()).(tree.IExpression) |
| 692 | right, _ := v.Visit(ctx.GetRight()).(tree.IExpression) |
| 693 | logicalBinaryExpr := tree.NewLogicalBinaryExpression( |
| 694 | v.getLocation(ctx), |
| 695 | operator, |
| 696 | left, |
| 697 | right) |
| 698 | logicalBinaryExpr.SetValue(fmt.Sprintf("LogicalBinaryExpression: (%s)", v.getText(ctx.BaseParserRuleContext))) |
| 699 | return logicalBinaryExpr |
| 700 | } |
| 701 | |
| 702 | // VisitBooleanDefault visits the node |
| 703 | func (v *ASTBuilder) VisitBooleanDefault(ctx *antlrgen.BooleanDefaultContext) interface{} { |
nothing calls this directly
no test coverage detected