check for the correct types when pruning values
There is not one more non-dependent type to look for when pruning unused values. This fixes the oversight, but still leaves the ugly concrete type checking which we need to remove.
This commit is contained in:
parent
2df7127943
commit
c0bca9d5e9
|
@ -220,11 +220,22 @@ func (t *PruneUnusedValuesTransformer) Transform(g *Graph) error {
|
|||
log.Printf("[TRACE] PruneUnusedValuesTransformer: removing unused value %s", dag.VertexName(v))
|
||||
g.Remove(v)
|
||||
removed++
|
||||
case 1:
|
||||
default:
|
||||
// because an output's destroy node always depends on the output,
|
||||
// we need to check for the case of a single destroy node.
|
||||
d := dependants.List()[0]
|
||||
if _, ok := d.(*NodeDestroyableOutput); ok {
|
||||
removable := true
|
||||
SEARCH:
|
||||
for _, d := range dependants.List() {
|
||||
switch d.(type) {
|
||||
case *NodeDestroyableOutput, *nodeCloseModule:
|
||||
//pass
|
||||
default:
|
||||
removable = false
|
||||
break SEARCH
|
||||
}
|
||||
}
|
||||
|
||||
if removable {
|
||||
log.Printf("[TRACE] PruneUnusedValuesTransformer: removing unused value %s", dag.VertexName(v))
|
||||
g.Remove(v)
|
||||
removed++
|
||||
|
|
Loading…
Reference in New Issue