| Index: tools/gn/scope.cc
|
| diff --git a/tools/gn/scope.cc b/tools/gn/scope.cc
|
| index bee4ce0aa2dedc766c6fe7b34faea55fd0c1554d..d1f179d98106869e56235db772df8f33d869c74f 100644
|
| --- a/tools/gn/scope.cc
|
| +++ b/tools/gn/scope.cc
|
| @@ -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);
|
| }
|
|
|
|
|