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/scope.h" | 5 #include "tools/gn/scope.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "tools/gn/parse_tree.h" | 9 #include "tools/gn/parse_tree.h" |
10 #include "tools/gn/template.h" | 10 #include "tools/gn/template.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 // Want to clobber since we've flattened some nested scopes, and our parent | 370 // Want to clobber since we've flattened some nested scopes, and our parent |
371 // scope may have a duplicate value set. | 371 // scope may have a duplicate value set. |
372 MergeOptions options; | 372 MergeOptions options; |
373 options.clobber_existing = true; | 373 options.clobber_existing = true; |
374 | 374 |
375 // Add in our variables and we're done. | 375 // Add in our variables and we're done. |
376 Err err; | 376 Err err; |
377 NonRecursiveMergeTo(result.get(), options, nullptr, "<SHOULDN'T HAPPEN>", | 377 NonRecursiveMergeTo(result.get(), options, nullptr, "<SHOULDN'T HAPPEN>", |
378 &err); | 378 &err); |
379 DCHECK(!err.has_error()); | 379 DCHECK(!err.has_error()); |
380 return result.Pass(); | 380 return result; |
381 } | 381 } |
382 | 382 |
383 Scope* Scope::MakeTargetDefaults(const std::string& target_type) { | 383 Scope* Scope::MakeTargetDefaults(const std::string& target_type) { |
384 if (GetTargetDefaults(target_type)) | 384 if (GetTargetDefaults(target_type)) |
385 return nullptr; | 385 return nullptr; |
386 | 386 |
387 Scope** dest = &target_defaults_[target_type]; | 387 Scope** dest = &target_defaults_[target_type]; |
388 if (*dest) { | 388 if (*dest) { |
389 NOTREACHED(); // Already set. | 389 NOTREACHED(); // Already set. |
390 return *dest; | 390 return *dest; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 } | 484 } |
485 | 485 |
486 void Scope::AddProvider(ProgrammaticProvider* p) { | 486 void Scope::AddProvider(ProgrammaticProvider* p) { |
487 programmatic_providers_.insert(p); | 487 programmatic_providers_.insert(p); |
488 } | 488 } |
489 | 489 |
490 void Scope::RemoveProvider(ProgrammaticProvider* p) { | 490 void Scope::RemoveProvider(ProgrammaticProvider* p) { |
491 DCHECK(programmatic_providers_.find(p) != programmatic_providers_.end()); | 491 DCHECK(programmatic_providers_.find(p) != programmatic_providers_.end()); |
492 programmatic_providers_.erase(p); | 492 programmatic_providers_.erase(p); |
493 } | 493 } |
OLD | NEW |