def visit
bend-lint-rules@0.2.0.0 · performance/drop_in_bang.bend:28
import bend-lint-rules@0.2.0.0/performance/drop_in_bang.bend as DropInBang
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
import bend-lint-api@0.2.0.0/shared/names.bend as Names
import bend-lint-rules@0.2.0.0/performance/gpu_fit.bend as GpuFit
28
29def visit(
30 +program: Program,
31 +path: List<&2, Lint.Above>,
32 +node: Lint.Node
33) -> List<&2, Lint.Finding>:
34 match program node:
35 case Program{
36 defs,
37 bangs
38 } Lint.Node{
39 Lint.Application{},
40 n,
41 span,
42 Con{Lint.Node{Lint.Reference{+t}, callee, Some{Lint.Span{p, beg, end}}, k, f}, args},
43 facts
44 }:
45 Lint.finding(
46 Lint.Warning{},
47 List.contains(
48 ~U32,
49 ~U32.is_eq,
50 bangs,
51 end
52 )
53 && GpuFit.is_drop(Names.find(Lint.Def, defs, t), t),
54 span,
55 message(callee)
56 )
57 case _ _:
58 []