Answer architecture round 3: splitArm builds a resolved reference's arm in one call

This commit is contained in:
2026-10-09 11:06:44 +02:00
committed by Lillem4n
parent 4e63044c03
commit c00504af8c
+3 -8
View File
@@ -33,15 +33,10 @@ const (
// resolveRefs resolved it to; before that, a reference is whole.
func splitArm(name string, refs map[string]resolvedRef) arm {
if grammar.IsRef(name) {
r, resolved := refs[name]
if !resolved || len(r.tail) == 0 {
head := name
if resolved {
head = r.head
}
return pathArm(name, head, nil)
if r, resolved := refs[name]; resolved {
return pathArm(name, r.head, r.tail)
}
return pathArm(name, r.head, r.tail)
return pathArm(name, name, nil)
}
segs, err := grammar.SplitPath(name)
if err != nil || len(segs) == 1 {