| 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/functions.h" | 5 #include "tools/gn/functions.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <iostream> | 8 #include <iostream> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 if (!EnsureSingleStringArg(function, args, err) || | 330 if (!EnsureSingleStringArg(function, args, err) || |
| 331 !EnsureNotProcessingImport(function, scope, err)) | 331 !EnsureNotProcessingImport(function, scope, err)) |
| 332 return Value(); | 332 return Value(); |
| 333 | 333 |
| 334 Label label(MakeLabelForScope(scope, function, args[0].string_value())); | 334 Label label(MakeLabelForScope(scope, function, args[0].string_value())); |
| 335 | 335 |
| 336 if (g_scheduler->verbose_logging()) | 336 if (g_scheduler->verbose_logging()) |
| 337 g_scheduler->Log("Defining config", label.GetUserVisibleName(true)); | 337 g_scheduler->Log("Defining config", label.GetUserVisibleName(true)); |
| 338 | 338 |
| 339 // Create the new config. | 339 // Create the new config. |
| 340 std::unique_ptr<Config> config(new Config(scope->settings(), label)); | 340 std::unique_ptr<Config> config( |
| 341 new Config(scope->settings(), label, scope->source_files_hashes())); |
| 341 config->set_defined_from(function); | 342 config->set_defined_from(function); |
| 342 if (!Visibility::FillItemVisibility(config.get(), scope, err)) | 343 if (!Visibility::FillItemVisibility(config.get(), scope, err)) |
| 343 return Value(); | 344 return Value(); |
| 344 | 345 |
| 345 // Fill the flags and such. | 346 // Fill the flags and such. |
| 346 const SourceDir& input_dir = scope->GetSourceDir(); | 347 const SourceDir& input_dir = scope->GetSourceDir(); |
| 347 ConfigValuesGenerator gen(&config->own_values(), scope, input_dir, err); | 348 ConfigValuesGenerator gen(&config->own_values(), scope, input_dir, err); |
| 348 gen.Run(); | 349 gen.Run(); |
| 349 if (err->has_error()) | 350 if (err->has_error()) |
| 350 return Value(); | 351 return Value(); |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 786 |
| 786 if (!depth->VerifyTypeIs(Value::INTEGER, err)) | 787 if (!depth->VerifyTypeIs(Value::INTEGER, err)) |
| 787 return Value(); | 788 return Value(); |
| 788 | 789 |
| 789 if (depth->int_value() < 0) { | 790 if (depth->int_value() < 0) { |
| 790 *err = Err(function, "depth must be positive or nul."); | 791 *err = Err(function, "depth must be positive or nul."); |
| 791 return Value(); | 792 return Value(); |
| 792 } | 793 } |
| 793 | 794 |
| 794 // Create the new pool. | 795 // Create the new pool. |
| 795 std::unique_ptr<Pool> pool(new Pool(scope->settings(), label)); | 796 std::unique_ptr<Pool> pool( |
| 797 new Pool(scope->settings(), label, scope->source_files_hashes())); |
| 796 pool->set_depth(depth->int_value()); | 798 pool->set_depth(depth->int_value()); |
| 797 | 799 |
| 798 // Save the generated item. | 800 // Save the generated item. |
| 799 Scope::ItemVector* collector = scope->GetItemCollector(); | 801 Scope::ItemVector* collector = scope->GetItemCollector(); |
| 800 if (!collector) { | 802 if (!collector) { |
| 801 *err = Err(function, "Can't define a pool in this context."); | 803 *err = Err(function, "Can't define a pool in this context."); |
| 802 return Value(); | 804 return Value(); |
| 803 } | 805 } |
| 804 collector->push_back(pool.release()); | 806 collector->push_back(pool.release()); |
| 805 | 807 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 } | 1139 } |
| 1138 | 1140 |
| 1139 // Otherwise it's a no-block function. | 1141 // Otherwise it's a no-block function. |
| 1140 if (!VerifyNoBlockForFunctionCall(function, block, err)) | 1142 if (!VerifyNoBlockForFunctionCall(function, block, err)) |
| 1141 return Value(); | 1143 return Value(); |
| 1142 return found_function->second.no_block_runner(scope, function, | 1144 return found_function->second.no_block_runner(scope, function, |
| 1143 args.list_value(), err); | 1145 args.list_value(), err); |
| 1144 } | 1146 } |
| 1145 | 1147 |
| 1146 } // namespace functions | 1148 } // namespace functions |
| OLD | NEW |