Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: tools/gn/scope.cc

Issue 2586073002: Revert GN declare_args() change. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/scope.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/scope.cc
diff --git a/tools/gn/scope.cc b/tools/gn/scope.cc
index 650c64aacbd82f6c4e18e2ae4be2c344d76c9405..fbe73f448239661b4674537f2440363daf101f15 100644
--- a/tools/gn/scope.cc
+++ b/tools/gn/scope.cc
@@ -78,37 +78,25 @@ bool Scope::HasValues(SearchNested search_nested) const {
const Value* Scope::GetValue(const base::StringPiece& ident,
bool counts_as_used) {
- const Scope* found_in_scope = nullptr;
- return GetValueWithScope(ident, counts_as_used, &found_in_scope);
-}
-
-const Value* Scope::GetValueWithScope(const base::StringPiece& ident,
- bool counts_as_used,
- const Scope** found_in_scope) {
// First check for programmatically-provided values.
for (auto* provider : programmatic_providers_) {
const Value* v = provider->GetProgrammaticValue(ident);
- if (v) {
- *found_in_scope = nullptr;
+ if (v)
return v;
- }
}
RecordMap::iterator found = values_.find(ident);
if (found != values_.end()) {
if (counts_as_used)
found->second.used = true;
- *found_in_scope = this;
return &found->second.value;
}
// Search in the parent scope.
if (const_containing_)
- return const_containing_->GetValueWithScope(ident, found_in_scope);
- if (mutable_containing_) {
- return mutable_containing_->GetValueWithScope(ident, counts_as_used,
- found_in_scope);
- }
+ return const_containing_->GetValue(ident);
+ if (mutable_containing_)
+ return mutable_containing_->GetValue(ident, counts_as_used);
return nullptr;
}
@@ -143,19 +131,11 @@ base::StringPiece Scope::GetStorageKey(const base::StringPiece& ident) const {
}
const Value* Scope::GetValue(const base::StringPiece& ident) const {
- const Scope *found_in_scope = nullptr;
- return GetValueWithScope(ident, &found_in_scope);
-}
-
-const Value* Scope::GetValueWithScope(const base::StringPiece& ident,
- const Scope** found_in_scope) const {
RecordMap::const_iterator found = values_.find(ident);
- if (found != values_.end()) {
- *found_in_scope = this;
+ if (found != values_.end())
return &found->second.value;
- }
if (containing())
- return containing()->GetValueWithScope(ident, found_in_scope);
+ return containing()->GetValue(ident);
return nullptr;
}
« no previous file with comments | « tools/gn/scope.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698