def returns_io

bend-lint-rules@0.2.0.0 · performance/missed_fork.bend:70

import bend-lint-rules@0.2.0.0/performance/missed_fork.bend as MissedFork
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint

70# Whether a definition's nodes say it returns IO, as written.
71def returns_io(nodes: List<&2, Lint.Node>) -> Bool:
72  match nodes:
73    case Nil{}:
74      False{}
75    case Con{
76      Lint.Node{Lint.Returns{}, n, s, Con{Lint.Node{Lint.Reference{t}, rn, rs, rk, rf}, k}, f},
77      rest
78    }:
79      String.eq(t, "IO")
80    case Con{
81      Lint.Node{
82        Lint.Returns{},
83        n,
84        s,
85        Con{
86          Lint.Node{
87            Lint.Application{},
88            an,
89            as,
90            Con{Lint.Node{Lint.Reference{t}, rn, rs, rk, rf}, ak},
91            af
92          },
93          k
94        },
95        f
96      },
97      rest
98    }:
99      String.eq(t, "IO")
100    case Con{node, rest}:
101      returns_io(rest)

Uses (5)

Used by (1)