diff options
author | Adam Lesinski <adamlesinski@google.com> | 2017-05-30 20:53:38 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-30 20:53:38 +0000 |
commit | ce1e415d558fe1067ca55f24ff4af9598f78154d (patch) | |
tree | 2cf711ce1c410e212eab766988ccf618f32ca4da /tools/aapt2/ResourceParser.cpp | |
parent | 4d476366bec9a2fd87692b9c4480ca86c9548ec4 (diff) | |
parent | 8255ced3f5a2bff41b78e839d2d89d815a0bb3dd (diff) |
Merge "AAPT2: Fix <add-resource> tag for overlays" into oc-dev
am: 8255ced3f5
Change-Id: Icc420eea48a8379723c0bc84a5f30c03ac2a2492
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 10244da31390..bc133781df6a 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; |