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

Method Visit

optimizer/sum_array.go:11–20  ·  view source on GitHub ↗
(node *Node)

Source from the content-addressed store, hash-verified

9type sumArray struct{}
10
11func (*sumArray) Visit(node *Node) {
12 if sumBuiltin, ok := (*node).(*BuiltinNode); ok &&
13 sumBuiltin.Name == "sum" &&
14 len(sumBuiltin.Arguments) == 1 {
15 if array, ok := sumBuiltin.Arguments[0].(*ArrayNode); ok &&
16 len(array.Nodes) >= 2 {
17 patchCopyType(node, sumArrayFold(array))
18 }
19 }
20}
21
22func sumArrayFold(array *ArrayNode) *BinaryNode {
23 if len(array.Nodes) > 2 {

Callers

nothing calls this directly

Calls 2

patchCopyTypeFunction · 0.85
sumArrayFoldFunction · 0.85

Tested by

no test coverage detected