use map.delete and last_node

pull/1398/head
Joe Conigliaro 2019-07-31 18:50:51 +10:00 committed by Alexander Medvednikov
parent 9b45b9ce66
commit 8c04b5fe9c
1 changed files with 4 additions and 14 deletions

View File

@ -101,20 +101,10 @@ pub fn(graph &ModDepGraph) resolve() *ModDepGraph {
return g return g
} }
ready_set.size() > 0 {
mut new_set := map[string]DepSet{}
for name in ready_set.items { for name in ready_set.items {
// node_deps.remove(name) node_deps.delete(name)
resolved.nodes << node_names[name] resolved.nodes << node_names[name]
} }
// remove once we have map.remove/delete
for k, d in node_deps {
if !k in ready_set.items {
new_set[k] = d
}
}
node_deps = new_set
}
for name, deps in node_deps { for name, deps in node_deps {
node_deps[name] = deps.diff(ready_set) node_deps[name] = deps.diff(ready_set)
@ -140,7 +130,7 @@ pub fn(graph &ModDepGraph) last_node() ModDepGraphNode {
} }
pub fn(graph &ModDepGraph) last_cycle() string { pub fn(graph &ModDepGraph) last_cycle() string {
return graph.nodes[graph.nodes.len-1].last_cycle return graph.last_node().last_cycle
} }
pub fn(graph &ModDepGraph) display() { pub fn(graph &ModDepGraph) display() {