-
-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Problem It would be nice to execute code before and after children are visited in graph traversals. The context of this change is the implementation of Dependency Banning (#6541), and the propagation of constraints through the dependency graph. ### Solution Add optional prelude and epilogue function parameters to the dep. graph walk functions, that get executed right before visiting children. This should not incur any API or performance changes for existing code. ### Result Calls like these are now possible: ``` a = self.make_target('a') b = self.make_target('b', dependencies=[a]) names = [] self.build_graph.walk_transitive_dependency_graph( [b.address], work=lambda x: names.append(x.name), postorder=postorder, prelude=lambda x: names.append(x.name + "-pre"), epilogue=lambda x: names.append(x.name + "-epi"), ) assertEqual(names, ['b', 'b-pre', 'a', 'a-pre', 'a-epi', 'b-epi']) ``` Blocks: #6541
- Loading branch information
1 parent
c83f6f1
commit 0176dc2
Showing
2 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters