summaryrefslogtreecommitdiffstats
path: root/src/manifest_parser.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/manifest_parser.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/manifest_parser.cc')
-rw-r--r--src/manifest_parser.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/manifest_parser.cc b/src/manifest_parser.cc
index 7ee990b..044b259 100644
--- a/src/manifest_parser.cc
+++ b/src/manifest_parser.cc
@@ -156,7 +156,7 @@ bool ManifestParser::ParseRule(string* err) {
if (!ExpectToken(Lexer::NEWLINE, err))
return false;
- if (state_->LookupRule(name) != NULL)
+ if (env_->LookupRuleCurrentScope(name) != NULL)
return lexer_.Error("duplicate rule '" + name + "'", err);
Rule* rule = new Rule(name); // XXX scoped_ptr
@@ -185,7 +185,7 @@ bool ManifestParser::ParseRule(string* err) {
if (rule->bindings_["command"].empty())
return lexer_.Error("expected 'command =' line", err);
- state_->AddRule(rule);
+ env_->AddRule(rule);
return true;
}
@@ -252,7 +252,7 @@ bool ManifestParser::ParseEdge(string* err) {
if (!lexer_.ReadIdent(&rule_name))
return lexer_.Error("expected build command name", err);
- const Rule* rule = state_->LookupRule(rule_name);
+ const Rule* rule = env_->LookupRule(rule_name);
if (!rule)
return lexer_.Error("unknown build rule '" + rule_name + "'", err);