def params.of.go
bolt@1.27.0.0 · src/rules/calls.bend:139
import bolt@1.27.0.0/src/rules/calls.bend as Calls
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
139
140
141def params.of.go(sig: Tree.Node, hit: Maybe<&2, Tree.Node>) -> Tree.Node:
142 match sig:
143 case Tree.NCons{Tree.Group{Lex.Tok{k, +o, l, c}, kids, close}, rest}:
144 match hit:
145 case Some{x}:
146 x
147 case None{}:
148 params.of.go(rest, Bool.pick(Maybe<&2, Tree.Node>, String.eq(o, "("), Some{kids}, None{}))
149 case Tree.NCons{h, rest}:
150 match hit:
151 case Some{x}:
152 x
153 case None{}:
154 params.of.go(rest, None{})
155 case other:
156 match hit:
157 case Some{x}:
158 x
159 case None{}:
160 Tree.NNil{}