Added nested FlexBuffer parsing

Change-Id: I918b66eb5646d035e3aae675f745802eb54b03ea
This commit is contained in:
Wouter van Oortmerssen
2017-06-02 16:41:22 -07:00
parent 0a81eb6463
commit dddd0865cb
16 changed files with 326 additions and 22 deletions

View File

@@ -725,6 +725,14 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
LookupCreateStruct(nested->constant);
}
if (field->attributes.Lookup("flexbuffer")) {
uses_flexbuffers_ = true;
if (field->value.type.base_type != BASE_TYPE_VECTOR ||
field->value.type.element != BASE_TYPE_UCHAR)
return Error(
"flexbuffer attribute may only apply to a vector of ubyte");
}
if (typefield) {
// If this field is a union, and it has a manually assigned id,
// the automatically added type field should have an id as well (of N - 1).