MCPcopy Create free account
hub / github.com/cel-expr/cel-go / VisitCreateMessage

Method VisitCreateMessage

parser/parser.go:630–644  ·  view source on GitHub ↗

Visit a parse tree produced by CELParser#CreateMessage.

(ctx *gen.CreateMessageContext)

Source from the content-addressed store, hash-verified

628
629// Visit a parse tree produced by CELParser#CreateMessage.
630func (p *parser) VisitCreateMessage(ctx *gen.CreateMessageContext) any {
631 messageName := ""
632 for _, id := range ctx.GetIds() {
633 if len(messageName) != 0 {
634 messageName += "."
635 }
636 messageName += id.GetText()
637 }
638 if ctx.GetLeadingDot() != nil {
639 messageName = "." + messageName
640 }
641 objID := p.helper.id(ctx.GetOp())
642 entries := p.VisitIFieldInitializerList(ctx.GetEntries()).([]ast.EntryExpr)
643 return p.helper.newObject(objID, messageName, entries...)
644}
645
646// Visit a parse tree of field initializers.
647func (p *parser) VisitIFieldInitializerList(ctx gen.IFieldInitializerListContext) any {

Callers 1

VisitMethod · 0.95

Calls 8

GetTextMethod · 0.80
idMethod · 0.80
newObjectMethod · 0.80
GetLeadingDotMethod · 0.65
GetOpMethod · 0.65
GetIdsMethod · 0.45
GetEntriesMethod · 0.45

Tested by

no test coverage detected