Answer architecture round 3: splitArm builds a resolved reference's arm in one call
This commit is contained in:
@@ -33,16 +33,11 @@ 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, name, nil)
|
||||
}
|
||||
segs, err := grammar.SplitPath(name)
|
||||
if err != nil || len(segs) == 1 {
|
||||
return pathArm(name, name, nil)
|
||||
|
||||
Reference in New Issue
Block a user