| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tools/gn/value.h" | 5 #include "tools/gn/value.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "tools/gn/scope.h" | 9 #include "tools/gn/scope.h" |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 string_value_ = other.string_value_; | 81 string_value_ = other.string_value_; |
| 82 boolean_value_ = other.boolean_value_; | 82 boolean_value_ = other.boolean_value_; |
| 83 int_value_ = other.int_value_; | 83 int_value_ = other.int_value_; |
| 84 list_value_ = other.list_value_; | 84 list_value_ = other.list_value_; |
| 85 if (type() == SCOPE && other.scope_value_.get()) | 85 if (type() == SCOPE && other.scope_value_.get()) |
| 86 scope_value_ = other.scope_value_->MakeClosure(); | 86 scope_value_ = other.scope_value_->MakeClosure(); |
| 87 origin_ = other.origin_; | 87 origin_ = other.origin_; |
| 88 return *this; | 88 return *this; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void Value::RecursivelySetOrigin(const ParseNode* origin) { | |
| 92 set_origin(origin); | |
| 93 if (type_ == Value::LIST) { | |
| 94 for (size_t i = 0; i < list_value_.size(); i++) | |
| 95 list_value_[i].RecursivelySetOrigin(origin); | |
| 96 } | |
| 97 } | |
| 98 | |
| 99 // static | 91 // static |
| 100 const char* Value::DescribeType(Type t) { | 92 const char* Value::DescribeType(Type t) { |
| 101 switch (t) { | 93 switch (t) { |
| 102 case NONE: | 94 case NONE: |
| 103 return "none"; | 95 return "none"; |
| 104 case BOOLEAN: | 96 case BOOLEAN: |
| 105 return "boolean"; | 97 return "boolean"; |
| 106 case INTEGER: | 98 case INTEGER: |
| 107 return "integer"; | 99 return "integer"; |
| 108 case STRING: | 100 case STRING: |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // iteration code. | 198 // iteration code. |
| 207 return false; | 199 return false; |
| 208 default: | 200 default: |
| 209 return false; | 201 return false; |
| 210 } | 202 } |
| 211 } | 203 } |
| 212 | 204 |
| 213 bool Value::operator!=(const Value& other) const { | 205 bool Value::operator!=(const Value& other) const { |
| 214 return !operator==(other); | 206 return !operator==(other); |
| 215 } | 207 } |
| OLD | NEW |