diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-03-19 03:56:28 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-03-19 03:56:28 (GMT) |
commit | e1f9c8d8534374b37dfcfc6772ad22a88b32ef85 (patch) | |
tree | 64262419ca129e38ae5df67194505d1ed8e4aa7f | |
parent | 717619a260633ca0e7c9eb2366130fc06ebacfff (diff) | |
parent | bc38ef76ebfabe503b1b56a1e32827a851037766 (diff) | |
download | Ninja-e1f9c8d8534374b37dfcfc6772ad22a88b32ef85.zip Ninja-e1f9c8d8534374b37dfcfc6772ad22a88b32ef85.tar.gz Ninja-e1f9c8d8534374b37dfcfc6772ad22a88b32ef85.tar.bz2 |
Merge pull request #936 from nico/cleanup
Minor cleanups. No behavior change.
-rw-r--r-- | src/eval_env.cc | 2 | ||||
-rw-r--r-- | src/eval_env.h | 7 | ||||
-rw-r--r-- | src/graph.cc | 5 |
3 files changed, 4 insertions, 10 deletions
diff --git a/src/eval_env.cc b/src/eval_env.cc index 8f5c8ee..e03a82e 100644 --- a/src/eval_env.cc +++ b/src/eval_env.cc @@ -74,7 +74,7 @@ bool Rule::IsReservedBinding(const string& var) { var == "rspfile_content"; } -const map<string, const Rule*> BindingEnv::GetRules() const { +const map<string, const Rule*>& BindingEnv::GetRules() const { return rules_; } diff --git a/src/eval_env.h b/src/eval_env.h index 7b9bdf5..28c4d16 100644 --- a/src/eval_env.h +++ b/src/eval_env.h @@ -28,7 +28,6 @@ struct Rule; struct Env { virtual ~Env() {} virtual string LookupVariable(const string& var) = 0; - virtual const Rule* LookupRule(const string& rule_name) = 0; }; /// A tokenized string that contains variable references. @@ -77,7 +76,7 @@ struct Rule { /// as well as a pointer to a parent scope. struct BindingEnv : public Env { BindingEnv() : parent_(NULL) {} - explicit BindingEnv(Env* parent) : parent_(parent) {} + explicit BindingEnv(BindingEnv* parent) : parent_(parent) {} virtual ~BindingEnv() {} virtual string LookupVariable(const string& var); @@ -85,7 +84,7 @@ struct BindingEnv : public Env { void AddRule(const Rule* rule); const Rule* LookupRule(const string& rule_name); const Rule* LookupRuleCurrentScope(const string& rule_name); - const map<string, const Rule*> GetRules() const; + const map<string, const Rule*>& GetRules() const; void AddBinding(const string& key, const string& val); @@ -100,7 +99,7 @@ struct BindingEnv : public Env { private: map<string, string> bindings_; map<string, const Rule*> rules_; - Env* parent_; + BindingEnv* parent_; }; #endif // NINJA_EVAL_ENV_H_ diff --git a/src/graph.cc b/src/graph.cc index 76c4e9a..e3253fd 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -207,7 +207,6 @@ struct EdgeEnv : public Env { EdgeEnv(Edge* edge, EscapeKind escape) : edge_(edge), escape_in_out_(escape) {} virtual string LookupVariable(const string& var); - virtual const Rule* LookupRule(const string& rule_name); /// Given a span of Nodes, construct a list of paths suitable for a command /// line. @@ -219,10 +218,6 @@ struct EdgeEnv : public Env { EscapeKind escape_in_out_; }; -const Rule* EdgeEnv::LookupRule(const string& rule_name) { - return NULL; -} - string EdgeEnv::LookupVariable(const string& var) { if (var == "in" || var == "in_newline") { int explicit_deps_count = edge_->inputs_.size() - edge_->implicit_deps_ - |