(elem any)
| 28 | var _ debug.Adorner = &semanticAdorner{} |
| 29 | |
| 30 | func (a *semanticAdorner) GetMetadata(elem any) string { |
| 31 | result := "" |
| 32 | e, isExpr := elem.(ast.Expr) |
| 33 | if !isExpr { |
| 34 | return result |
| 35 | } |
| 36 | t := a.checked.TypeMap()[e.ID()] |
| 37 | if t != nil { |
| 38 | result += "~" |
| 39 | result += FormatCELType(t) |
| 40 | } |
| 41 | |
| 42 | switch e.Kind() { |
| 43 | case ast.IdentKind, |
| 44 | ast.CallKind, |
| 45 | ast.ListKind, |
| 46 | ast.StructKind, |
| 47 | ast.SelectKind: |
| 48 | if ref, found := a.checked.ReferenceMap()[e.ID()]; found { |
| 49 | if len(ref.OverloadIDs) == 0 { |
| 50 | result += "^" + ref.Name |
| 51 | } else { |
| 52 | sort.Strings(ref.OverloadIDs) |
| 53 | for i, overload := range ref.OverloadIDs { |
| 54 | if i == 0 { |
| 55 | result += "^" |
| 56 | } else { |
| 57 | result += "|" |
| 58 | } |
| 59 | result += overload |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | return result |
| 66 | } |
| 67 | |
| 68 | // Print returns a string representation of the Expr message, |
| 69 | // annotated with types from the CheckedExpr. The Expr must |
nothing calls this directly
no test coverage detected