Give a pick key one type, pickKey, and key every read's levels from the head its steps start at to its leaf

This commit is contained in:
2026-10-05 23:25:46 +02:00
committed by Lillem4n
parent b726edd7cb
commit 44b6f1ef89
10 changed files with 75 additions and 73 deletions
+5 -5
View File
@@ -57,7 +57,7 @@ type nameTarget struct {
// target, the keys its reads address, and its reads.
type linkedNames struct {
targets map[*nameBinding]nameTarget
addressed map[*nameBinding]map[string]string
addressed map[*nameBinding]map[pickKey]string
uses map[*nameBinding][]nameUse
}
@@ -117,15 +117,15 @@ func nameTargets(ts []linkSite) map[*nameBinding]nameTarget {
// addressedKeys is every key the reads of each name in ts land on or pass, from the name, with the
// spelling of the first read reaching it.
func addressedKeys(ts []linkSite, targets map[*nameBinding]nameTarget) map[*nameBinding]map[string]string {
keys := map[*nameBinding]map[string]string{}
func addressedKeys(ts []linkSite, targets map[*nameBinding]nameTarget) map[*nameBinding]map[pickKey]string {
keys := map[*nameBinding]map[pickKey]string{}
for _, s := range ts {
for _, r := range namedReads(s.t) {
b := r.a.named
if keys[b] == nil {
keys[b] = map[string]string{}
keys[b] = map[pickKey]string{}
}
for _, key := range append(r.a.levels[len(targets[b].tail):], r.a.path) {
for _, key := range r.a.levels[len(targets[b].tail):] {
if _, seen := keys[b][key]; !seen {
keys[b][key] = r.a.spelling
}