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

Unified Diff: tools/gn/value.cc

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/value.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/value.cc
diff --git a/tools/gn/value.cc b/tools/gn/value.cc
index 659ebb9bb0b12517864a65e8203bd5a678212ecb..6bf78da2cfaf5753b7af7c6586a284f7c6edd29d 100644
--- a/tools/gn/value.cc
+++ b/tools/gn/value.cc
@@ -10,6 +10,7 @@ Value::Value()
: type_(NONE),
boolean_value_(false),
int_value_(0),
+ scope_value_(NULL),
origin_(NULL) {
}
@@ -17,6 +18,7 @@ Value::Value(const ParseNode* origin, Type t)
: type_(t),
boolean_value_(false),
int_value_(0),
+ scope_value_(NULL),
origin_(origin) {
}
@@ -24,6 +26,7 @@ Value::Value(const ParseNode* origin, bool bool_val)
: type_(BOOLEAN),
boolean_value_(bool_val),
int_value_(0),
+ scope_value_(NULL),
origin_(origin) {
}
@@ -31,6 +34,7 @@ Value::Value(const ParseNode* origin, int64 int_val)
: type_(INTEGER),
boolean_value_(false),
int_value_(int_val),
+ scope_value_(NULL),
origin_(origin) {
}
@@ -39,6 +43,7 @@ Value::Value(const ParseNode* origin, std::string str_val)
string_value_(),
boolean_value_(false),
int_value_(0),
+ scope_value_(NULL),
origin_(origin) {
string_value_.swap(str_val);
}
@@ -48,6 +53,16 @@ Value::Value(const ParseNode* origin, const char* str_val)
string_value_(str_val),
boolean_value_(false),
int_value_(0),
+ scope_value_(NULL),
+ origin_(origin) {
+}
+
+Value::Value(const ParseNode* origin, Scope* scope)
+ : type_(SCOPE),
+ string_value_(),
+ boolean_value_(false),
+ int_value_(0),
+ scope_value_(scope),
origin_(origin) {
}
@@ -75,6 +90,8 @@ const char* Value::DescribeType(Type t) {
return "string";
case LIST:
return "list";
+ case SCOPE:
+ return "scope";
default:
NOTREACHED();
return "UNKNOWN";
@@ -103,6 +120,8 @@ std::string Value::ToString(bool quote_string) const {
result.push_back(']');
return result;
}
+ case SCOPE:
+ return std::string("<scope>");
}
return std::string();
}
@@ -134,6 +153,10 @@ bool Value::operator==(const Value& other) const {
return false;
}
return true;
+ case Value::SCOPE:
+ // Its not clear what people mean when comparing scope values, so we test
+ // for scope identity and not contents equality.
+ return scope_value() == other.scope_value();
default:
return false;
}
« no previous file with comments | « tools/gn/value.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698