def deep
bend-lint-rules@0.2.0.0 · performance/deep_call_in_fork.bend:75
import bend-lint-rules@0.2.0.0/performance/deep_call_in_fork.bend as DeepCallInFork
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint
import bend-lint-api@0.2.0.0/shared/lists.bend as Lists
75
76
77def deep(nodes: List<&2, Lint.Node>, +forking: Bool, out: List<&2, String>) -> List<&2, String>:
78 match nodes:
79 case Nil{}:
80 out
81 case Con{Lint.Node{Lint.Definition{+t, u}, n, s, +k, f}, rest}:
82 deep(
83 rest,
84 forking,
85 Lists.push(
86 String,
87 Lists.when(
88 String,
89 deep.if(
90 List.contains(
91 ~Bool,
92 ~Bool.and,
93 Lint.visit(
94 ~Unit,
95 ~Bool,
96 ~deep.visit,
97 Unit{},
98 [Lint.Node{Lint.Definition{t, u}, n, s, k, f}]
99 ),
100 True{}
101 ),
102 forking,
103 k
104 ),
105 t
106 ),
107 out
108 )
109 )
110 case Con{node, rest}:
111 deep(rest, forking, out)