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

Unified Diff: tools/gn/scope.cc

Issue 1263053003: Add forward_variables_from() and target() to GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More spelling fixes Created 5 years, 4 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 bee4ce0aa2dedc766c6fe7b34faea55fd0c1554d..37ddbddb11a35fb08d32edb8a036c8f4cfe87dd3 100644
--- a/tools/gn/scope.cc
+++ b/tools/gn/scope.cc
@@ -61,7 +61,7 @@ Scope::~Scope() {
const Value* Scope::GetValue(const base::StringPiece& ident,
bool counts_as_used) {
- // First check for programatically-provided values.
+ // First check for programmatically-provided values.
for (const auto& provider : programmatic_providers_) {
const Value* v = provider->GetProgrammaticValue(ident);
if (v)
@@ -85,7 +85,7 @@ const Value* Scope::GetValue(const base::StringPiece& ident,
Value* Scope::GetMutableValue(const base::StringPiece& ident,
bool counts_as_used) {
- // Don't do programatic values, which are not mutable.
+ // Don't do programmatic values, which are not mutable.
RecordMap::iterator found = values_.find(ident);
if (found != values_.end()) {
if (counts_as_used)
@@ -116,6 +116,17 @@ Value* Scope::GetValueForcedToCurrentScope(const base::StringPiece& ident,
return nullptr;
}
+base::StringPiece Scope::GetStorageKey(const base::StringPiece& ident) const {
+ RecordMap::const_iterator found = values_.find(ident);
+ if (found != values_.end())
+ return found->first;
+
+ // Search in parent scope.
+ if (containing())
+ return containing()->GetStorageKey(ident);
+ return base::StringPiece();
+}
+
const Value* Scope::GetValue(const base::StringPiece& ident) const {
RecordMap::const_iterator found = values_.find(ident);
if (found != values_.end())
@@ -180,6 +191,11 @@ void Scope::MarkUsed(const base::StringPiece& ident) {
found->second.used = true;
}
+void Scope::MarkAllUsed() {
+ for (auto& cur : values_)
+ cur.second.used = true;
+}
+
void Scope::MarkUnused(const base::StringPiece& ident) {
RecordMap::iterator found = values_.find(ident);
if (found == values_.end()) {
@@ -255,7 +271,7 @@ bool Scope::NonRecursiveMergeTo(Scope* dest,
}
dest->values_[pair.first] = pair.second;
- if (options.mark_used)
+ if (options.mark_dest_used)
dest->MarkUsed(pair.first);
}
« 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