diff options
author | Wouter van Oortmerssen <aardappel@gmail.com> | 2017-01-27 15:28:57 -0800 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2017-01-27 15:30:08 -0800 |
commit | 9b3d8b318a3bc9d71d08b50d723996f556557c86 (patch) | |
tree | baba803dfa3abfe3fdf8469f29cebe7fbc700f1d | |
parent | 87e29b25def0159ac3d6607595643c2131d7b811 (diff) | |
download | flatbuffers-9b3d8b318a3bc9d71d08b50d723996f556557c86.tar.gz flatbuffers-9b3d8b318a3bc9d71d08b50d723996f556557c86.tar.bz2 flatbuffers-9b3d8b318a3bc9d71d08b50d723996f556557c86.zip |
Added tracking of order of types declared.
Change-Id: Iade313c99f119dcf1619674260648a33f61dc030
-rw-r--r-- | include/flatbuffers/idl.h | 1 | ||||
-rw-r--r-- | src/idl_parser.cpp | 4 | ||||
-rw-r--r-- | tests/union_vector/union_vector_generated.h | 4 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/flatbuffers/idl.h b/include/flatbuffers/idl.h index aab4b8fa..898b4104 100644 --- a/include/flatbuffers/idl.h +++ b/include/flatbuffers/idl.h @@ -578,6 +578,7 @@ private: BaseType baseType); public: + SymbolTable<Type> types_; SymbolTable<StructDef> structs_; SymbolTable<EnumDef> enums_; SymbolTable<ServiceDef> services_; diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index fa7b98bf..5974d044 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -1314,6 +1314,8 @@ CheckedError Parser::ParseEnum(bool is_union, EnumDef **dest) { } } if (dest) *dest = &enum_def; + types_.Add(namespaces_.back()->GetFullyQualifiedName(enum_def.name), + new Type(BASE_TYPE_UNION, nullptr, &enum_def)); return NoError(); } @@ -1419,6 +1421,8 @@ CheckedError Parser::ParseDecl() { ECHECK(CheckClash(fields, struct_def, "_byte_vector", BASE_TYPE_STRING)); ECHECK(CheckClash(fields, struct_def, "ByteVector", BASE_TYPE_STRING)); EXPECT('}'); + types_.Add(namespaces_.back()->GetFullyQualifiedName(struct_def->name), + new Type(BASE_TYPE_STRUCT, struct_def, nullptr)); return NoError(); } diff --git a/tests/union_vector/union_vector_generated.h b/tests/union_vector/union_vector_generated.h index 180b3d99..560860c6 100644 --- a/tests/union_vector/union_vector_generated.h +++ b/tests/union_vector/union_vector_generated.h @@ -266,8 +266,8 @@ inline bool VerifyCharacterVector(flatbuffers::Verifier &verifier, const flatbuf if (values->size() != types->size()) return false; for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { if (!VerifyCharacter( - verifier, values->Get(i), types->GetEnum<Character>(i))) { - return false; + verifier, values->Get(i), types->GetEnum<Character>(i))) { + return false; } } return true; |