def param_name

bolt@1.27.0.0 · src/rules/calls.bend:170

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

170# a parameter's name: its first lowercase name before the colon ("" for a
171# type parameter like `-A: Type`)
172def param_name(pp: Tree.Node) -> String:
173  match pp:
174    case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TName{}, t, l, c}}, rest}:
175      t
176    case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TColon{}, t, l, c}}, rest}:
177      ""
178    case Tree.NCons{h, rest}:
179      param_name(rest)
180    case other:
181      ""

Uses (4)

Used by (4)