Refactoring: split the function CompilationGraph::Build() into two parts.