From 57d8557ff3bfe6772f2dbada1d1ffa5d378ca763 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 25 Nov 2011 15:18:03 +0000 Subject: [PATCH] Factor out Edge::EvaluateDepFile --- src/graph.cc | 9 ++++++--- src/graph.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/graph.cc b/src/graph.cc index d881280..424f941 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -177,6 +177,11 @@ string Edge::EvaluateCommand() { return rule_->command_.Evaluate(&env); } +string Edge::EvaluateDepFile() { + EdgeEnv env(this); + return rule_->depfile_.Evaluate(&env); +} + string Edge::GetDescription() { EdgeEnv env(this); return rule_->description_.Evaluate(&env); @@ -184,9 +189,7 @@ string Edge::GetDescription() { bool Edge::LoadDepFile(State* state, DiskInterface* disk_interface, string* err) { - EdgeEnv env(this); - string path = rule_->depfile_.Evaluate(&env); - + string path = EvaluateDepFile(); string content = disk_interface->ReadFile(path, err); if (!err->empty()) return false; diff --git a/src/graph.h b/src/graph.h index 9080dcc..67f7b10 100644 --- a/src/graph.h +++ b/src/graph.h @@ -92,6 +92,7 @@ struct Edge { const string& command, Node* output); string EvaluateCommand(); // XXX move to env, take env ptr + string EvaluateDepFile(); string GetDescription(); bool LoadDepFile(State* state, DiskInterface* disk_interface, string* err); -- 2.7.4