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

Method visitStructMap

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

Source from the content-addressed store, hash-verified

420}
421
422func (un *unparser) visitStructMap(expr ast.Expr) error {
423 m := expr.AsMap()
424 entries := m.Entries()
425 un.str.WriteString("{")
426 for i, e := range entries {
427 entry := e.AsMapEntry()
428 k := entry.Key()
429 if entry.IsOptional() {
430 un.str.WriteString("?")
431 }
432 err := un.visit(k)
433 if err != nil {
434 return err
435 }
436 un.str.WriteString(": ")
437 v := entry.Value()
438 err = un.visit(v)
439 if err != nil {
440 return err
441 }
442 if i < len(entries)-1 {
443 un.str.WriteString(", ")
444 }
445 }
446 un.str.WriteString("}")
447 return nil
448}
449
450func (un *unparser) visitMaybeMacroCall(expr ast.Expr) (bool, error) {
451 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