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); |
} |