def scan
bend-lint-rules@0.2.0.0 · language/reused_binder.bend:111
import bend-lint-rules@0.2.0.0/language/reused_binder.bend as ReusedBinder
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
111
112
113
114def scan(
115 nodes: List<&2, Lint.Node>,
116 +b: U32,
117 +live: Bool,
118 +apart: Bool,
119 +typed: Bool,
120 +at: U32,
121 seen: Seen
122) -> Seen:
123 match nodes:
124 case Nil{}:
125 seen
126 case Con{Lint.Node{+syntax, name, span, +kids, facts}, rest}:
127 +node = {Lint.Node{syntax, name, span, kids, facts}: Lint.Node}
128 +here = live && Bool.not(typed && U32.is_gt(at, 0))
129 scan(
130 rest,
131 b,
132 live,
133 apart,
134 typed,
135 (at + 1: U32),
136 Seen.then(
137 apart,
138 seen,
139 Seen.of(
140 node,
141 b,
142 here,
143 scan(
144 kids,
145 b,
146 is_live_inside(node, here),
147 is_match(syntax),
148 is_annotation(syntax),
149 0,
150 Seen{None{}, None{}}
151 )
152 )
153 )
154 )