Visit a parse tree produced by CELParser#mapInitializerList.
(ctx *gen.MapInitializerListContext)
| 645 | |
| 646 | // Visit a parse tree produced by CELParser#mapInitializerList. |
| 647 | func (p *antlrVisitor) VisitMapInitializerList(ctx *gen.MapInitializerListContext) any { |
| 648 | if ctx == nil || ctx.GetKeys() == nil { |
| 649 | // This is the result of a syntax error handled elswhere, return empty. |
| 650 | return []ast.EntryExpr{} |
| 651 | } |
| 652 | |
| 653 | result := make([]ast.EntryExpr, len(ctx.GetCols())) |
| 654 | keys := ctx.GetKeys() |
| 655 | vals := ctx.GetValues() |
| 656 | for i, col := range ctx.GetCols() { |
| 657 | colID := p.helper.id(col) |
| 658 | if i >= len(keys) || i >= len(vals) { |
| 659 | // This is the result of a syntax error detected elsewhere. |
| 660 | return []ast.EntryExpr{} |
| 661 | } |
| 662 | optKey := keys[i] |
| 663 | optional := optKey.GetOpt() != nil |
| 664 | if !p.enableOptionalSyntax && optional { |
| 665 | p.reportError(optKey, "unsupported syntax '?'") |
| 666 | continue |
| 667 | } |
| 668 | key := p.Visit(optKey.GetE()).(ast.Expr) |
| 669 | value := p.Visit(vals[i]).(ast.Expr) |
| 670 | entry := p.helper.newMapEntry(colID, key, value, optional) |
| 671 | result[i] = entry |
| 672 | } |
| 673 | return result |
| 674 | } |
| 675 | |
| 676 | // Visit a parse tree produced by CELParser#Int. |
| 677 | func (p *antlrVisitor) VisitInt(ctx *gen.IntContext) any { |
no test coverage detected