Index: tools/gn/value.cc |
diff --git a/tools/gn/value.cc b/tools/gn/value.cc |
index 6bf78da2cfaf5753b7af7c6586a284f7c6edd29d..443ee06dc2a6c481c9e9bfb8658780ae70bc516b 100644 |
--- a/tools/gn/value.cc |
+++ b/tools/gn/value.cc |
@@ -92,6 +92,8 @@ const char* Value::DescribeType(Type t) { |
return "list"; |
case SCOPE: |
return "scope"; |
+ case DICT: |
+ return "dict"; |
default: |
NOTREACHED(); |
return "UNKNOWN"; |
@@ -122,6 +124,15 @@ std::string Value::ToString(bool quote_string) const { |
} |
case SCOPE: |
return std::string("<scope>"); |
+ case DICT: { |
+ std::string result = "{\n"; |
+ for (std::map<std::string, Value>::const_iterator i = dict_value_.begin(); |
+ i != dict_value_.end(); ++i) { |
+ result += " " + i->first + " = " + i->second.ToString(true) + "\n"; |
+ } |
+ result += "}"; |
+ return result; |
+ } |
} |
return std::string(); |
} |
@@ -154,9 +165,14 @@ bool Value::operator==(const Value& other) const { |
} |
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(); |
+ // Scopes are always considered not equal because there's currently |
+ // no use case for comparing them, and it requires a bunch of complex |
+ // iteration code. |
+ return false; |
+ case Value::DICT: |
+ return dict_value_.size() == other.dict_value_.size() && |
+ std::equal(dict_value_.begin(), dict_value_.end(), |
+ other.dict_value_.begin()); |
default: |
return false; |
} |