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) |
BindingEnv () | |
BindingEnv (Env *parent) | |
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_ |
Env * | parent_ |
An Env which contains a mapping of variables to values as well as a pointer to a parent scope.
Definition at line 35 of file eval_env.h.
|
inline |
Definition at line 36 of file eval_env.h.
|
inlineexplicit |
Definition at line 37 of file eval_env.h.
|
inlinevirtual |
Definition at line 39 of file eval_env.h.
void BindingEnv::AddBinding | ( | const string & | key, |
const string & | val | ||
) |
Definition at line 26 of file eval_env.cc.
References bindings_.
Referenced by ManifestParser::Parse(), and ManifestParser::ParseEdge().
|
virtual |
Implements Env.
Definition at line 17 of file eval_env.cc.
References bindings_, Env::LookupVariable(), and parent_.
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 30 of file eval_env.cc.
References bindings_, EvalString::Evaluate(), Env::LookupVariable(), and parent_.
Referenced by EdgeEnv::LookupVariable().
|
private |
Definition at line 53 of file eval_env.h.
Referenced by AddBinding(), LookupVariable(), and LookupWithFallback().
|
private |
Definition at line 54 of file eval_env.h.
Referenced by LookupVariable(), and LookupWithFallback().