diff options
author | Adam Lesinski <adamlesinski@google.com> | 2017-05-30 20:42:00 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-05-30 20:42:07 +0000 |
commit | 8255ced3f5a2bff41b78e839d2d89d815a0bb3dd (patch) | |
tree | 9f756cc834eab813b6e1f94f54352b2493167933 /tools/aapt2/ResourceParser.cpp | |
parent | 1399d3abf51265915a3d6cbd2b04be2a3142c609 (diff) | |
parent | 4488f1c74a0f7df09f2b201f7caa228d729e8389 (diff) |
Merge "AAPT2: Fix <add-resource> tag for overlays" into oc-dev
Diffstat (limited to 'tools/aapt2/ResourceParser.cpp')
-rw-r--r-- | tools/aapt2/ResourceParser.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp index 0d1850fed26a..57ae2700127c 100644 --- a/tools/aapt2/ResourceParser.cpp +++ b/tools/aapt2/ResourceParser.cpp @@ -92,14 +92,14 @@ struct ParsedResource { Source source; ResourceId id; Maybe<SymbolState> symbol_state; + bool allow_new = false; std::string comment; std::unique_ptr<Value> value; std::list<ParsedResource> child_resources; }; // Recursively adds resources to the ResourceTable. -static bool AddResourcesToTable(ResourceTable* table, IDiagnostics* diag, - ParsedResource* res) { +static bool AddResourcesToTable(ResourceTable* table, IDiagnostics* diag, ParsedResource* res) { StringPiece trimmed_comment = util::TrimWhitespace(res->comment); if (trimmed_comment.size() != res->comment.size()) { // Only if there was a change do we re-assign. @@ -111,6 +111,7 @@ static bool AddResourcesToTable(ResourceTable* table, IDiagnostics* diag, symbol.state = res->symbol_state.value(); symbol.source = res->source; symbol.comment = res->comment; + symbol.allow_new = res->allow_new; if (!table->SetSymbolState(res->name, res->id, symbol, diag)) { return false; } @@ -121,8 +122,8 @@ static bool AddResourcesToTable(ResourceTable* table, IDiagnostics* diag, res->value->SetComment(std::move(res->comment)); res->value->SetSource(std::move(res->source)); - if (!table->AddResource(res->name, res->id, res->config, res->product, - std::move(res->value), diag)) { + if (!table->AddResource(res->name, res->id, res->config, res->product, std::move(res->value), + diag)) { return false; } } @@ -849,6 +850,7 @@ bool ResourceParser::ParseAddResource(xml::XmlPullParser* parser, ParsedResource* out_resource) { if (ParseSymbolImpl(parser, out_resource)) { out_resource->symbol_state = SymbolState::kUndefined; + out_resource->allow_new = true; return true; } return false; |