summaryrefslogtreecommitdiffstats
path: root/src/state.cc
diff options
context:
space:
mode:
authorMohamed Bamakhrama <mohamed.bamakhrama@intel.com>2015-03-01 23:57:33 (GMT)
committerMohamed Bamakhrama <mohamed.bamakhrama@intel.com>2015-03-01 23:57:33 (GMT)
commitf8f293730de2e12f6575c5d890a16504340f75fe (patch)
treef4544bb3ab1fea478c57a2892616a5761c5769f6 /src/state.cc
parentc406d1c8adfedc1982e2c08ab95d581f65eb65de (diff)
downloadNinja-f8f293730de2e12f6575c5d890a16504340f75fe.zip
Ninja-f8f293730de2e12f6575c5d890a16504340f75fe.tar.gz
Ninja-f8f293730de2e12f6575c5d890a16504340f75fe.tar.bz2
Allow scoping rules through subninja
Ninja didn't support scoping rules through subninja and assumed a unique rule name in the whole namespace. With this change, this behavior is changed to allow scoping rules. Two rules can have the same name if they belong to two different scopes. However, two rules can NOT have the same name in the same scope.
Diffstat (limited to 'src/state.cc')
-rw-r--r--src/state.cc14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/state.cc b/src/state.cc
index 1ceda45..89f90c0 100644
--- a/src/state.cc
+++ b/src/state.cc
@@ -73,23 +73,11 @@ Pool State::kConsolePool("console", 1);
const Rule State::kPhonyRule("phony");
State::State() {
- AddRule(&kPhonyRule);
+ bindings_.AddRule(&kPhonyRule);
AddPool(&kDefaultPool);
AddPool(&kConsolePool);
}
-void State::AddRule(const Rule* rule) {
- assert(LookupRule(rule->name()) == NULL);
- rules_[rule->name()] = rule;
-}
-
-const Rule* State::LookupRule(const string& rule_name) {
- map<string, const Rule*>::iterator i = rules_.find(rule_name);
- if (i == rules_.end())
- return NULL;
- return i->second;
-}
-
void State::AddPool(Pool* pool) {
assert(LookupPool(pool->name()) == NULL);
pools_[pool->name()] = pool;