def names
bolt@1.27.0.0 · src/rules/pedantic/rewalk.bend:470
import bolt@1.27.0.0/src/rules/pedantic/rewalk.bend as Rewalk
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
470
471def names(nn: Tree.Node, +acc: List<&2, String>) -> List<&2, String>:
472 match nn:
473 case Tree.Leaf{Lex.Tok{Lex.TName{}, +t, l, c}}:
474 t <> acc
475 case Tree.Group{open, kids, close}:
476 names(kids, acc)
477 case Tree.Stmt{kind, kids, body}:
478 names(body, names(kids, acc))
479 case Tree.NCons{h, rest}:
480 names(rest, names(h, acc))
481 case other:
482 acc