Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: tools/gn/value.h

Issue 207233003: Add "." accessors to GN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/tokenizer_unittest.cc ('k') | tools/gn/value.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/value.h
diff --git a/tools/gn/value.h b/tools/gn/value.h
index 092b8522309d209124d697cc245e5220786cef51..ee201c45e7b6a8065f3d014724eade3f79eccb8b 100644
--- a/tools/gn/value.h
+++ b/tools/gn/value.h
@@ -11,6 +11,7 @@
#include "tools/gn/err.h"
class ParseNode;
+class Scope;
// Represents a variable value in the interpreter.
class Value {
@@ -20,7 +21,8 @@ class Value {
BOOLEAN,
INTEGER,
STRING,
- LIST
+ LIST,
+ SCOPE
};
Value();
@@ -29,6 +31,8 @@ class Value {
Value(const ParseNode* origin, int64 int_val);
Value(const ParseNode* origin, std::string str_val);
Value(const ParseNode* origin, const char* str_val);
+ Value(const ParseNode* origin, Scope* scope); // Non-owning ptr.
+ // (must outlive Value.)
~Value();
Type type() const { return type_; }
@@ -80,6 +84,15 @@ class Value {
return list_value_;
}
+ Scope* scope_value() {
+ DCHECK(type_ == SCOPE);
+ return scope_value_;
+ }
+ const Scope* scope_value() const {
+ DCHECK(type_ == SCOPE);
+ return scope_value_;
+ }
+
// Converts the given value to a string. Returns true if strings should be
// quoted or the ToString of a string should be the string itself.
std::string ToString(bool quote_strings) const;
@@ -98,6 +111,8 @@ class Value {
bool boolean_value_;
int64 int_value_;
std::vector<Value> list_value_;
+ Scope* scope_value_; // Non-owning.
+
const ParseNode* origin_;
};
« no previous file with comments | « tools/gn/tokenizer_unittest.cc ('k') | tools/gn/value.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698