Fix at compile how readField reads an arm, deleting its two panics and its held lookup per read

This commit is contained in:
2026-09-30 20:35:41 +02:00
committed by Lillem4n
parent efbad0f325
commit 26b35abe70
3 changed files with 18 additions and 8 deletions
+10
View File
@@ -315,8 +315,18 @@ type arm struct {
steps []pathStep
leaves []node // every node the path may land on, one per variant it passes
cover node // what holding the path pins: the first choice it passes, else its leaf
kind armKind
}
// armKind is how expand reads an arm, fixed at compile.
type armKind uint8
const (
freshRead armKind = iota // drawn afresh at every read
heldRead // drawn once per expansion, kept in its hold
refPathRead // drawn once per draw group, kept in its memo
)
func (a arm) isRefPath() bool {
return isRef(a.head) && len(a.tail) > 0
}