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