VisitSelect visits a parse tree produced by CELParser#Select.
(ctx *gen.SelectContext)
| 565 | |
| 566 | // VisitSelect visits a parse tree produced by CELParser#Select. |
| 567 | func (p *parser) VisitSelect(ctx *gen.SelectContext) any { |
| 568 | operand := p.Visit(ctx.Member()).(ast.Expr) |
| 569 | // Handle the error case where no valid identifier is specified. |
| 570 | if ctx.GetId() == nil || ctx.GetOp() == nil { |
| 571 | return p.helper.newExpr(ctx) |
| 572 | } |
| 573 | id, err := p.normalizeIdent(ctx.GetId()) |
| 574 | if err != nil { |
| 575 | p.reportError(ctx.GetId(), "%v", err) |
| 576 | } |
| 577 | if ctx.GetOpt() != nil { |
| 578 | if !p.enableOptionalSyntax { |
| 579 | return p.reportError(ctx.GetOp(), "unsupported syntax '.?'") |
| 580 | } |
| 581 | return p.helper.newGlobalCall( |
| 582 | ctx.GetOp(), |
| 583 | operators.OptSelect, |
| 584 | operand, |
| 585 | p.helper.newLiteralString(ctx.GetId(), id)) |
| 586 | } |
| 587 | return p.helper.newSelect(ctx.GetOp(), operand, id) |
| 588 | } |
| 589 | |
| 590 | // VisitMemberCall visits a parse tree produced by CELParser#MemberCall. |
| 591 | func (p *parser) VisitMemberCall(ctx *gen.MemberCallContext) any { |
no test coverage detected