diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-03-09 04:46:34 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-03-09 04:48:21 (GMT) |
commit | 52e667fa3d77d59ed07fa136e5a19f169dc9fc0b (patch) | |
tree | 8f91db7c8942c1fc8d24da8aeb07742160ae66b3 /src/eval_env.h | |
parent | b0c9eab3f67547eb0f6c24721fe002f414505e73 (diff) | |
download | Ninja-52e667fa3d77d59ed07fa136e5a19f169dc9fc0b.zip Ninja-52e667fa3d77d59ed07fa136e5a19f169dc9fc0b.tar.gz Ninja-52e667fa3d77d59ed07fa136e5a19f169dc9fc0b.tar.bz2 |
Fix build with libc++ after #921.
It failed with
error: field has incomplete type 'EvalString'
note: in instantiation of exception specification for 'map' requested here
explicit Rule(const string& name) : name_(name) {}
^
Diffstat (limited to 'src/eval_env.h')
-rw-r--r-- | src/eval_env.h | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/eval_env.h b/src/eval_env.h index 46ea131..7b9bdf5 100644 --- a/src/eval_env.h +++ b/src/eval_env.h @@ -22,7 +22,35 @@ using namespace std; #include "string_piece.h" -struct EvalString; +struct Rule; + +/// An interface for a scope for variable (e.g. "$foo") lookups. +struct Env { + virtual ~Env() {} + virtual string LookupVariable(const string& var) = 0; + virtual const Rule* LookupRule(const string& rule_name) = 0; +}; + +/// A tokenized string that contains variable references. +/// Can be evaluated relative to an Env. +struct EvalString { + string Evaluate(Env* env) const; + + void Clear() { parsed_.clear(); } + bool empty() const { return parsed_.empty(); } + + void AddText(StringPiece text); + void AddSpecial(StringPiece text); + + /// Construct a human-readable representation of the parsed state, + /// for use in tests. + string Serialize() const; + +private: + enum TokenType { RAW, SPECIAL }; + typedef vector<pair<string, TokenType> > TokenList; + TokenList parsed_; +}; /// An invokable build command and associated metadata (description, etc.). struct Rule { @@ -45,13 +73,6 @@ struct Rule { map<string, EvalString> bindings_; }; -/// An interface for a scope for variable (e.g. "$foo") lookups. -struct Env { - virtual ~Env() {} - virtual string LookupVariable(const string& var) = 0; - virtual const Rule* LookupRule(const string& rule_name) = 0; -}; - /// An Env which contains a mapping of variables to values /// as well as a pointer to a parent scope. struct BindingEnv : public Env { @@ -82,25 +103,4 @@ private: Env* parent_; }; -/// A tokenized string that contains variable references. -/// Can be evaluated relative to an Env. -struct EvalString { - string Evaluate(Env* env) const; - - void Clear() { parsed_.clear(); } - bool empty() const { return parsed_.empty(); } - - void AddText(StringPiece text); - void AddSpecial(StringPiece text); - - /// Construct a human-readable representation of the parsed state, - /// for use in tests. - string Serialize() const; - -private: - enum TokenType { RAW, SPECIAL }; - typedef vector<pair<string, TokenType> > TokenList; - TokenList parsed_; -}; - #endif // NINJA_EVAL_ENV_H_ |