Precompute each choice's shared paths so a dotted path stays O(1)

This commit is contained in:
Mikael Göransson
2026-08-27 23:45:08 +02:00
committed by lilleman-tw
parent af5b8c9abd
commit 1665b37cad
7 changed files with 57 additions and 41 deletions
+4 -2
View File
@@ -7,8 +7,10 @@ import (
)
// refPrefix marks a {..path} token: a reference to a node elsewhere in the data
// root rather than a sibling field. The path after it is the same dot path Fake
// takes, resolved across every loaded directory (see linkRefs).
// root rather than a sibling field. The path is resolved across every loaded
// directory (see linkRefs), and is stricter than the one Fake takes: a reference
// binds one node, so it cannot step through a multi-variant choice even where Fake
// and List can.
const refPrefix = ".."
func isRef(name string) bool { return strings.HasPrefix(name, refPrefix) }