MCPcopy Index your code
hub / github.com/expr-lang/expr / Visit

Method Visit

optimizer/count_any.go:13–36  ·  view source on GitHub ↗
(node *Node)

Source from the content-addressed store, hash-verified

11type countAny struct{}
12
13func (*countAny) Visit(node *Node) {
14 binary, ok := (*node).(*BinaryNode)
15 if !ok {
16 return
17 }
18
19 count, ok := binary.Left.(*BuiltinNode)
20 if !ok || count.Name != "count" || len(count.Arguments) != 2 {
21 return
22 }
23
24 integer, ok := binary.Right.(*IntegerNode)
25 if !ok {
26 return
27 }
28
29 if (binary.Operator == ">" && integer.Value == 0) ||
30 (binary.Operator == ">=" && integer.Value == 1) {
31 patchCopyType(node, &BuiltinNode{
32 Name: "any",
33 Arguments: count.Arguments,
34 })
35 }
36}

Callers

nothing calls this directly

Calls 1

patchCopyTypeFunction · 0.85

Tested by

no test coverage detected