def ns.search.go

bend-osdev-acpi@0.1.1.0 · aml_ns.bend:189

import bend-osdev-acpi@0.1.1.0/aml_ns.bend as AmlNs
import Base

189# the search for a NameSeg from a scope outward; hit: it is in this scope;
190# top: this scope is the root
191def ns.search.go(n: Nat, hit: Bool, top: Bool, +ns: AmlNs, +scope: String, +seg: String) -> Maybe<&2, String>:
192  match n:
193    case 0n:
194      None{}
195    case 1n+k:
196      match hit:
197        case True{}:
198          Some{AmlPath.child(scope, seg)}
199        case False{}:
200          match top:
201            case True{}:
202              None{}
203            case False{}:
204              +up = AmlPath.parent(scope)
205              ns.search.go(k, AmlNs.has(ns, AmlPath.child(up, seg)), AmlPath.is_root(up), ns, up, seg)

Uses (9)

Used by (1)