OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/build_settings.h" | 5 #include "tools/gn/build_settings.h" |
6 #include "tools/gn/functions.h" | 6 #include "tools/gn/functions.h" |
7 #include "tools/gn/parse_tree.h" | 7 #include "tools/gn/parse_tree.h" |
8 #include "tools/gn/settings.h" | 8 #include "tools/gn/settings.h" |
9 #include "tools/gn/substitution_writer.h" | 9 #include "tools/gn/substitution_writer.h" |
10 #include "tools/gn/target.h" | 10 #include "tools/gn/target.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // Find the referenced target. The targets previously encountered in this | 86 // Find the referenced target. The targets previously encountered in this |
87 // scope will have been stashed in the item collector (they'll be dispatched | 87 // scope will have been stashed in the item collector (they'll be dispatched |
88 // when this file is done running) so we can look through them. | 88 // when this file is done running) so we can look through them. |
89 const Target* target = nullptr; | 89 const Target* target = nullptr; |
90 Scope::ItemVector* collector = scope->GetItemCollector(); | 90 Scope::ItemVector* collector = scope->GetItemCollector(); |
91 if (!collector) { | 91 if (!collector) { |
92 *err = Err(function, "No targets defined in this context."); | 92 *err = Err(function, "No targets defined in this context."); |
93 return Value(); | 93 return Value(); |
94 } | 94 } |
95 for (const auto& item : *collector) { | 95 for (auto* item : *collector) { |
96 if (item->label() != label) | 96 if (item->label() != label) |
97 continue; | 97 continue; |
98 | 98 |
99 const Target* as_target = item->AsTarget(); | 99 const Target* as_target = item->AsTarget(); |
100 if (!as_target) { | 100 if (!as_target) { |
101 *err = Err(function, "Label does not refer to a target.", | 101 *err = Err(function, "Label does not refer to a target.", |
102 label.GetUserVisibleName(false) + | 102 label.GetUserVisibleName(false) + |
103 "\nrefers to a " + item->GetItemTypeName()); | 103 "\nrefers to a " + item->GetItemTypeName()); |
104 return Value(); | 104 return Value(); |
105 } | 105 } |
(...skipping 25 matching lines...) Expand all Loading... |
131 // Convert to Values. | 131 // Convert to Values. |
132 Value ret(function, Value::LIST); | 132 Value ret(function, Value::LIST); |
133 ret.list_value().reserve(files.size()); | 133 ret.list_value().reserve(files.size()); |
134 for (const auto& file : files) | 134 for (const auto& file : files) |
135 ret.list_value().push_back(Value(function, file.value())); | 135 ret.list_value().push_back(Value(function, file.value())); |
136 | 136 |
137 return ret; | 137 return ret; |
138 } | 138 } |
139 | 139 |
140 } // namespace functions | 140 } // namespace functions |
OLD | NEW |