Factor out Edge::EvaluateDepFile
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 25 Nov 2011 15:18:03 +0000 (15:18 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 6 Dec 2011 09:05:15 +0000 (11:05 +0200)
src/graph.cc
src/graph.h

index d881280..424f941 100644 (file)
@@ -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;
index 9080dcc..67f7b10 100644 (file)
@@ -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);