def eat

bolt@1.27.0.0 · src/rules/pedantic/rewalk.bend:599

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

599# the left of `=`
600def eat(nn: Tree.Node, st: Lhs) -> Lhs:
601  match nn:
602    case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TEq{}, t, l, c}}, rest}:
603      st
604    case Tree.NCons{Tree.Leaf{Lex.Tok{Lex.TName{}, +t, l, c}}, rest}:
605      Lhs{seen, extra, field, nm} = st
606      eat(rest, add_seen(seen, extra, field, nm, t))
607    case Tree.NCons{Tree.Group{open, +kids, close}, rest}:
608      eat(rest, fold_names(kids, st))
609    case Tree.NCons{h, rest}:
610      eat(rest, st)
611    case other:
612      st

Uses (6)

Used by (1)