| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const FunctionCallNode* function, | 72 const FunctionCallNode* function, |
| 73 const std::vector<Value>& args, | 73 const std::vector<Value>& args, |
| 74 Err* err) { | 74 Err* err) { |
| 75 if (args.size() != 1) { | 75 if (args.size() != 1) { |
| 76 *err = Err(function, "Expected one argument."); | 76 *err = Err(function, "Expected one argument."); |
| 77 return Value(); | 77 return Value(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Resolve the requested label. | 80 // Resolve the requested label. |
| 81 Label label = Label::Resolve(scope->GetSourceDir(), | 81 Label label = Label::Resolve(scope->GetSourceDir(), |
| 82 ToolchainLabelForScope(scope), args[0], err); | 82 ToolchainLabelForScope(scope), args[0], |
| 83 scope->settings()->build_settings()->root_path(), |
| 84 err); |
| 83 if (label.is_null()) | 85 if (label.is_null()) |
| 84 return Value(); | 86 return Value(); |
| 85 | 87 |
| 86 // Find the referenced target. The targets previously encountered in this | 88 // Find the referenced target. The targets previously encountered in this |
| 87 // scope will have been stashed in the item collector (they'll be dispatched | 89 // 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. | 90 // when this file is done running) so we can look through them. |
| 89 const Target* target = NULL; | 91 const Target* target = NULL; |
| 90 Scope::ItemVector* collector = scope->GetItemCollector(); | 92 Scope::ItemVector* collector = scope->GetItemCollector(); |
| 91 if (!collector) { | 93 if (!collector) { |
| 92 *err = Err(function, "No targets defined in this context."); | 94 *err = Err(function, "No targets defined in this context."); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Convert to Values. | 134 // Convert to Values. |
| 133 Value ret(function, Value::LIST); | 135 Value ret(function, Value::LIST); |
| 134 ret.list_value().reserve(files.size()); | 136 ret.list_value().reserve(files.size()); |
| 135 for (const auto& file : files) | 137 for (const auto& file : files) |
| 136 ret.list_value().push_back(Value(function, file.value())); | 138 ret.list_value().push_back(Value(function, file.value())); |
| 137 | 139 |
| 138 return ret; | 140 return ret; |
| 139 } | 141 } |
| 140 | 142 |
| 141 } // namespace functions | 143 } // namespace functions |
| OLD | NEW |