correct the direction and walk order of the graph

This commit is contained in:
James Bardin 2021-08-05 15:57:44 -04:00
parent 88ad938cc6
commit 493ec4e6c5
1 changed files with 2 additions and 2 deletions

View File

@ -48,12 +48,12 @@ func ApplyMoves(stmts []MoveStatement, state *states.State) map[addrs.UniqueKey]
// The starting nodes are the ones that don't depend on any other nodes.
startNodes := make(dag.Set, len(stmts))
for _, v := range g.Vertices() {
if len(g.UpEdges(v)) == 0 {
if len(g.DownEdges(v)) == 0 {
startNodes.Add(v)
}
}
g.DepthFirstWalk(startNodes, func(v dag.Vertex, depth int) error {
g.ReverseDepthFirstWalk(startNodes, func(v dag.Vertex, depth int) error {
stmt := v.(*MoveStatement)
for _, ms := range state.Modules {