def site.group

bolt@1.27.0.0 · src/rules/suspicious/thunk.bend:77

import bolt@1.27.0.0/src/rules/suspicious/thunk.bend as Thunk
import Base
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/syntax/tree.bend as Tree

77# after the parameter, `=>`, the name and its `(` group: the finding when
78# they make a thunk of a self-call
79def site.group(
80  kp: Lex.TokKind,
81  +pp: String,
82  +aa: String,
83  +nm: String,
84  +ll: U32,
85  +cc: U32,
86  r3: Tree.Node,
87  +name: String,
88  +path: String
89) -> List<&2, F.Finding>:
90  match r3:
91    case Tree.NCons{Tree.Group{Lex.Tok{_ko, +o, _lo, _co}, kids, _cl}, after}:
92      +lead = Bool.and(Lex.is_name(kp), Bool.not(reads(kids, pp)))
93      Bool.pick(List<&2, F.Finding>,
94        hit(lead, String.eq(aa, "=>"), String.eq(nm, name), String.eq(o, "("), ends(after)),
95        [cite(ll, cc, name, path)], [])
96    case _other:
97      []

Uses (16)

Used by (1)