diff options
author | Evan Martin <martine@danga.com> | 2011-12-30 04:39:04 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-12-30 23:15:47 (GMT) |
commit | d44db63aea41f9965b9caa8f311d14ab65b1ad31 (patch) | |
tree | 62e9d66e5b0f23e1d0bcf5c7d41c37673d4fca9e /src | |
parent | 5cb21f16506808468f5c9c387b9c9f413dfe9b08 (diff) | |
download | Ninja-d44db63aea41f9965b9caa8f311d14ab65b1ad31.zip Ninja-d44db63aea41f9965b9caa8f311d14ab65b1ad31.tar.gz Ninja-d44db63aea41f9965b9caa8f311d14ab65b1ad31.tar.bz2 |
more private
Diffstat (limited to 'src')
-rw-r--r-- | src/eval_env.h | 2 | ||||
-rw-r--r-- | src/parsers.cc | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/eval_env.h b/src/eval_env.h index 2341bcb..6e0a0c0 100644 --- a/src/eval_env.h +++ b/src/eval_env.h @@ -32,10 +32,12 @@ struct Env { /// as well as a pointer to a parent scope. struct BindingEnv : public Env { BindingEnv() : parent_(NULL) {} + explicit BindingEnv(Env* parent) : parent_(parent) {} virtual ~BindingEnv() {} virtual string LookupVariable(const string& var); void AddBinding(const string& key, const string& val); +private: map<string, string> bindings_; Env* parent_; }; diff --git a/src/parsers.cc b/src/parsers.cc index 095e93f..506b209 100644 --- a/src/parsers.cc +++ b/src/parsers.cc @@ -243,8 +243,7 @@ bool ManifestParser::ParseEdge(string* err) { // But create and fill a nested env if there are variables in scope. if (lexer_.PeekToken(Lexer::INDENT)) { // XXX scoped_ptr to handle error case. - env = new BindingEnv; - env->parent_ = env_; + env = new BindingEnv(env_); do { string key; EvalString val; @@ -290,8 +289,7 @@ bool ManifestParser::ParseFileInclude(bool new_scope, string* err) { ManifestParser subparser(state_, file_reader_); if (new_scope) { - subparser.env_ = new BindingEnv; - subparser.env_->parent_ = env_; + subparser.env_ = new BindingEnv(env_); } else { subparser.env_ = env_; } |