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

Method VisitEntryExpr

common/ast/ast.go:647–657  ·  view source on GitHub ↗

VisitEntryExpr computes the max height of a map or struct entry and associates the height with the entry id.

(e EntryExpr)

Source from the content-addressed store, hash-verified

645
646// VisitEntryExpr computes the max height of a map or struct entry and associates the height with the entry id.
647func (hv heightVisitor) VisitEntryExpr(e EntryExpr) {
648 hv[e.ID()] = 0
649 switch e.Kind() {
650 case MapEntryKind:
651 me := e.AsMapEntry()
652 hv[e.ID()] = hv.maxHeight(me.Value(), me.Key())
653 case StructFieldKind:
654 sf := e.AsStructField()
655 hv[e.ID()] = hv[sf.Value().ID()]
656 }
657}
658
659func (hv heightVisitor) maxHeight(exprs ...Expr) int {
660 max := 0

Callers

nothing calls this directly

Calls 7

maxHeightMethod · 0.95
IDMethod · 0.65
KindMethod · 0.65
AsMapEntryMethod · 0.65
ValueMethod · 0.65
KeyMethod · 0.65
AsStructFieldMethod · 0.65

Tested by

no test coverage detected