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

Method VisitEntryExpr

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

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