Fix parser #lol
This commit is contained in:
parent
e6acf6c41c
commit
1a33eb5adf
@ -25,11 +25,11 @@ func buildChain(conf interface{}) *Chain {
|
|||||||
Links: []Caller{},
|
Links: []Caller{},
|
||||||
}
|
}
|
||||||
|
|
||||||
for flow, links := range conf.(map[string]interface{}) {
|
for f, links := range conf.(map[string]interface{}) {
|
||||||
if f, ok := FlowMap[flow]; ok {
|
if flow := FlowOf(f); flow != UnknownFlow {
|
||||||
c.Flow = f
|
c.Flow = flow
|
||||||
} else {
|
} else {
|
||||||
panic("Unknown chain flow: " + flow)
|
panic("Unknown chain flow: " + f)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, link := range links.([]interface{}) {
|
for _, link := range links.([]interface{}) {
|
||||||
@ -42,11 +42,12 @@ func buildChain(conf interface{}) *Chain {
|
|||||||
c.Links = append(c.Links, Caller(subchain))
|
c.Links = append(c.Links, Caller(subchain))
|
||||||
}
|
}
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
unit, ok := Units[link.(string)]
|
name := link.(string)
|
||||||
|
caller, ok := Units[name]
|
||||||
if !ok {
|
if !ok {
|
||||||
fmt.Println("Unknown unit `" + link.(string) + "`")
|
fmt.Println("Unknown unit:", name)
|
||||||
} else {
|
} else {
|
||||||
c.Links = append(c.Links, unit)
|
c.Links = append(c.Links, caller)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
panic("Unexpected chain element: " + val.Kind().String())
|
panic("Unexpected chain element: " + val.Kind().String())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user