Allow unions of table types with the same name but from different namespaces.

Also fixed most codegenerators using the wrong namespace when multiple
namespace were used in a file, with some files not being generated.

Change-Id: Ib42969221239d7244e431cbd667ef69200fc415f
Tested: on Linux.
Bug: 29338474
This commit is contained in:
Wouter van Oortmerssen
2016-06-17 18:16:11 -07:00
parent 6e177bf03f
commit 3639032d1e
25 changed files with 584 additions and 35 deletions

View File

@@ -1180,7 +1180,13 @@ CheckedError Parser::ParseEnum(bool is_union, EnumDef **dest) {
auto full_name = value_name;
std::vector<std::string> value_comment = doc_comment_;
EXPECT(kTokenIdentifier);
if (is_union) ECHECK(ParseNamespacing(&full_name, &value_name));
if (is_union) {
ECHECK(ParseNamespacing(&full_name, &value_name));
// Since we can't namespace the actual enum identifiers, turn
// namespace parts into part of the identifier.
value_name = full_name;
std::replace(value_name.begin(), value_name.end(), '.', '_');
}
auto prevsize = enum_def.vals.vec.size();
auto value = enum_def.vals.vec.size()
? enum_def.vals.vec.back()->value + 1