|
Ninja
|
An Env which contains a mapping of variables to values as well as a pointer to a parent scope. More...
#include <eval_env.h>

Public Member Functions | |
| void | AddBinding (const string &key, const string &val) |
| void | AddRule (const Rule *rule) |
| BindingEnv () | |
| BindingEnv (BindingEnv *parent) | |
| const map< string, const Rule * > & | GetRules () const |
| const Rule * | LookupRule (const string &rule_name) |
| const Rule * | LookupRuleCurrentScope (const string &rule_name) |
| virtual string | LookupVariable (const string &var) |
| string | LookupWithFallback (const string &var, const EvalString *eval, Env *env) |
| This is tricky. More... | |
| virtual | ~BindingEnv () |
Private Attributes | |
| map< string, string > | bindings_ |
| BindingEnv * | parent_ |
| map< string, const Rule * > | rules_ |
An Env which contains a mapping of variables to values as well as a pointer to a parent scope.
Definition at line 77 of file eval_env.h.
|
inline |
Definition at line 78 of file eval_env.h.
|
inlineexplicit |
Definition at line 79 of file eval_env.h.
|
inlinevirtual |
Definition at line 81 of file eval_env.h.
| void BindingEnv::AddBinding | ( | const string & | key, |
| const string & | val | ||
| ) |
Definition at line 28 of file eval_env.cc.
References bindings_.
Referenced by ManifestParser::Parse(), and ManifestParser::ParseEdge().
| void BindingEnv::AddRule | ( | const Rule * | rule | ) |
Definition at line 32 of file eval_env.cc.
References LookupRuleCurrentScope(), Rule::name(), and rules_.
Referenced by ManifestParser::ParseRule(), and State::State().
| const map< string, const Rule * > & BindingEnv::GetRules | ( | ) | const |
Definition at line 78 of file eval_env.cc.
References rules_.
| const Rule * BindingEnv::LookupRule | ( | const string & | rule_name | ) |
Definition at line 44 of file eval_env.cc.
References LookupRule(), parent_, and rules_.
Referenced by Cleaner::CleanRule(), Cleaner::CleanRules(), LookupRule(), and ManifestParser::ParseEdge().
| const Rule * BindingEnv::LookupRuleCurrentScope | ( | const string & | rule_name | ) |
Definition at line 37 of file eval_env.cc.
References rules_.
Referenced by AddRule(), and ManifestParser::ParseRule().
|
virtual |
Implements Env.
Definition at line 19 of file eval_env.cc.
References bindings_, LookupVariable(), and parent_.
Referenced by LookupVariable(), and LookupWithFallback().
| string BindingEnv::LookupWithFallback | ( | const string & | var, |
| const EvalString * | eval, | ||
| Env * | env | ||
| ) |
This is tricky.
Edges want lookup scope to go in this order: 1) value set on edge itself (edge_->env_) 2) value set on rule, with expansion in the edge's scope 3) value set on enclosing scope of edge (edge_->env_->parent_) This function takes as parameters the necessary info to do (2).
Definition at line 82 of file eval_env.cc.
References bindings_, EvalString::Evaluate(), LookupVariable(), and parent_.
Referenced by EdgeEnv::LookupVariable().
|
private |
Definition at line 100 of file eval_env.h.
Referenced by AddBinding(), LookupVariable(), and LookupWithFallback().
|
private |
Definition at line 102 of file eval_env.h.
Referenced by LookupRule(), LookupVariable(), and LookupWithFallback().
|
private |
Definition at line 101 of file eval_env.h.
Referenced by AddRule(), GetRules(), LookupRule(), and LookupRuleCurrentScope().
1.8.14