def alias_path.go

bolt@1.27.0.0 · src/rules/digest.bend:67

import bolt@1.27.0.0/src/rules/digest.bend as Digest
import Base

67# the path an alias names, when it is one; hit: the alias before as was
68# the name, so the search stops there
69def alias_path.go(as: List<&2, Alias>, +name: String, hit: Maybe<&2, String>) -> Maybe<&2, String>:
70  match as:
71    case Nil{}:
72      hit
73    case Con{Alias{+n, p}, rest}:
74      match hit:
75        case Some{x}:
76          Some{x}
77        case None{}:
78          alias_path.go(rest, name, Bool.pick(Maybe<&2, String>, String.eq(n, name), Some{p}, None{}))

Uses (6)

Used by (1)