def visit

bend-lint-rules@0.2.0.0 · performance/bang_after_fork.bend:114

import bend-lint-rules@0.2.0.0/performance/bang_after_fork.bend as BangAfterFork
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-api@0.2.0.0/shared/sets.bend as Sets
import bend-lint-rules@0.2.0.0/performance/gpu_fit.bend as GpuFit

114# The finding about an application below `path`, if it is a `!` call of a definition that forks, made after a fork.
115def visit(
116  +program: Program,
117  +path: List<&2, Lint.Above>,
118  +node: Lint.Node
119) -> List<&2, Lint.Finding>:
120  match program node:
121    case Program{
122      +defs,
123      +under,
124      +bangs
125    } Lint.Node{
126      Lint.Application{},
127      n,
128      span,
129      Con{Lint.Node{Lint.Reference{+t}, callee, Some{Lint.Span{p, beg, end}}, k, f}, args},
130      facts
131    }:
132      Lint.finding(
133        Lint.Warning{},
134        after.if(
135          List.contains(
136            ~U32,
137            ~U32.is_eq,
138            bangs,
139            end
140          )
141            && Sets.has(under, t)
142            && Bool.not(GpuFit.is_drop(Names.find(Lint.Def, defs, t), t)),
143          args,
144          path,
145          Program{defs, under, bangs}
146        ),
147        span,
148        message(callee)
149      )
150    case _ _:
151      []

Uses (21)

Used by (1)