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

Unified Diff: tools/gn/scope.cc

Issue 207233003: Add "." accessors to GN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 9 months 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') | tools/gn/scope_unittest.cc » ('j') | 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 3f714ec36d4664fd9865b348afdc67fa4b567c33..86f82beb804c87fcc17dc6def47d77ce77e5b17c 100644
--- a/tools/gn/scope.cc
+++ b/tools/gn/scope.cc
@@ -68,6 +68,22 @@ const Value* Scope::GetValue(const base::StringPiece& ident,
return NULL;
}
+Value* Scope::GetMutableValue(const base::StringPiece& ident,
+ bool counts_as_used) {
+ // Don't do programatic values, which are not mutable.
+ RecordMap::iterator found = values_.find(ident);
+ if (found != values_.end()) {
+ if (counts_as_used)
+ found->second.used = true;
+ return &found->second.value;
+ }
+
+ // Search in the parent mutable scope, but not const one.
+ if (mutable_containing_)
+ return mutable_containing_->GetMutableValue(ident, counts_as_used);
+ return NULL;
+}
+
Value* Scope::GetValueForcedToCurrentScope(const base::StringPiece& ident,
const ParseNode* set_node) {
RecordMap::iterator found = values_.find(ident);
« no previous file with comments | « tools/gn/scope.h ('k') | tools/gn/scope_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698