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

Method visitStructMap

parser/unparser.go:460–486  ·  view source on GitHub ↗
(expr ast.Expr)

Source from the content-addressed store, hash-verified

458}
459
460func (un *unparser) visitStructMap(expr ast.Expr) error {
461 m := expr.AsMap()
462 entries := m.Entries()
463 un.str.WriteString("{")
464 for i, e := range entries {
465 entry := e.AsMapEntry()
466 k := entry.Key()
467 if entry.IsOptional() {
468 un.str.WriteString("?")
469 }
470 err := un.visit(k)
471 if err != nil {
472 return err
473 }
474 un.str.WriteString(": ")
475 v := entry.Value()
476 err = un.visit(v)
477 if err != nil {
478 return err
479 }
480 if i < len(entries)-1 {
481 un.str.WriteString(", ")
482 }
483 }
484 un.str.WriteString("}")
485 return nil
486}
487
488func (un *unparser) visitMaybeMacroCall(expr ast.Expr) (bool, error) {
489 call, found := un.info.GetMacroCall(expr.ID())

Callers 1

visitMethod · 0.95

Calls 7

visitMethod · 0.95
AsMapMethod · 0.65
EntriesMethod · 0.65
AsMapEntryMethod · 0.65
KeyMethod · 0.65
IsOptionalMethod · 0.65
ValueMethod · 0.65

Tested by

no test coverage detected