def calls
bend-lint-rules@0.2.0.0 · performance/missed_fork.bend:123
import bend-lint-rules@0.2.0.0/performance/missed_fork.bend as MissedFork
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
123
124
125
126def calls(
127 nodes: List<&2, Lint.Node>,
128 +target: String,
129 out: List<&2, Lint.Span>,
130 inside: Bool
131) -> List<&2, Lint.Span>:
132 match nodes inside:
133 case _ True{}:
134 out
135 case Nil{} False{}:
136 out
137 case Con{Lint.Node{Lint.Application{}, n, span, +kids, f}, rest} False{}:
138 +call = calls.to(kids, target)
139 calls(
140 rest,
141 target,
142 calls(kids, target, called.at(call, span, out), call || is_choice(kids)),
143 False{}
144 )
145 case Con{Lint.Node{Lint.Construction{t}, n, s, kids, f}, rest} False{}:
146 calls(rest, target, calls(kids, target, out, False{}), False{})
147 case Con{Lint.Node{Lint.Annotation{}, n, s, kids, f}, rest} False{}:
148 calls(rest, target, calls(kids, target, out, False{}), False{})
149 case Con{node, rest} False{}:
150 calls(rest, target, out, False{})