Add walkDeps to context and module_ctx.

walkDeps performs a pre-order DFS (unlike visitDepsDepthFirst which is
a post-order DFS). The visit function takes in both a parent and child
node and returns a bool indicating if the child node should be
traversed.
diff --git a/context.go b/context.go
index dd2dc1d..982cf72 100644
--- a/context.go
+++ b/context.go
@@ -1825,6 +1825,27 @@
 	return nil
 }
 
+func (c *Context) walkDeps(topModule *moduleInfo,
+	visit func(Module, Module) bool) {
+
+	visited := make(map[*moduleInfo]bool)
+
+	var walk func(module *moduleInfo)
+	walk = func(module *moduleInfo) {
+		visited[module] = true
+
+		for _, moduleDep := range module.directDeps {
+			if !visited[moduleDep] {
+				if visit(moduleDep.logicModule, module.logicModule) {
+					walk(moduleDep)
+				}
+			}
+		}
+	}
+
+	walk(topModule)
+}
+
 func (c *Context) visitDepsDepthFirst(topModule *moduleInfo, visit func(Module)) {
 	visited := make(map[*moduleInfo]bool)
 
diff --git a/module_ctx.go b/module_ctx.go
index 6254596..94db01e 100644
--- a/module_ctx.go
+++ b/module_ctx.go
@@ -133,6 +133,7 @@
 	VisitDirectDepsIf(pred func(Module) bool, visit func(Module))
 	VisitDepsDepthFirst(visit func(Module))
 	VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module))
+	WalkDeps(visit func(Module, Module) bool)
 
 	ModuleSubDir() string
 
@@ -251,6 +252,10 @@
 	m.context.visitDepsDepthFirstIf(m.module, pred, visit)
 }
 
+func (m *moduleContext) WalkDeps(visit func(Module, Module) bool) {
+	m.context.walkDeps(m.module, visit)
+}
+
 func (m *moduleContext) ModuleSubDir() string {
 	return m.module.variantName
 }
@@ -382,6 +387,7 @@
 	VisitDirectDepsIf(pred func(Module) bool, visit func(Module))
 	VisitDepsDepthFirst(visit func(Module))
 	VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module))
+	WalkDeps(visit func(Module, Module) bool)
 }
 
 type BottomUpMutatorContext interface {
@@ -501,3 +507,7 @@
 
 	mctx.context.visitDepsDepthFirstIf(mctx.module, pred, visit)
 }
+
+func (mctx *mutatorContext) WalkDeps(visit func(Module, Module) bool) {
+	mctx.context.walkDeps(mctx.module, visit)
+}