def close
import ezx@1.11.0.0/src/sha/nar.bend as Narimport Base
import ezx@1.11.0.0/src/pkg/pkg.bend as K
350# the directory on top finished: its node is an entry of the one around it,
351# or the whole tree when there is none
352def close(top: Frame, up: List<&2, Frame>, es: List<&2, Ent>) -> Move:
353 Frame{_at, +name, kids} = top
354 match up:
355 case []:
356 Built{dir(kids)}
357 case Frame{pat, pname, pkids} <> rest:
358 Next{State{es, Frame{pat, pname, K.Item{name, dir(kids)} <> pkids}, rest}}