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

Method VisitEntryExpr

common/ast/ast.go:640–650  ·  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

638
639// VisitEntryExpr computes the max height of a map or struct entry and associates the height with the entry id.
640func (hv heightVisitor) VisitEntryExpr(e EntryExpr) {
641 hv[e.ID()] = 0
642 switch e.Kind() {
643 case MapEntryKind:
644 me := e.AsMapEntry()
645 hv[e.ID()] = hv.maxHeight(me.Value(), me.Key())
646 case StructFieldKind:
647 sf := e.AsStructField()
648 hv[e.ID()] = hv[sf.Value().ID()]
649 }
650}
651
652func (hv heightVisitor) maxHeight(exprs ...Expr) int {
653 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