mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 20:31:23 +00:00
Allows structs to be stored directly as member variables.
Introduce a "native_inline" attribute that can be applied on fields that are structs. This results in NativeTable code generation that sets the struct "inline" rather than storing it in a pointer. From cl/140527470. Change-Id: I208724f552b8b921b20923e0bf82f42cb3582416
This commit is contained in:
@@ -680,6 +680,11 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
|
||||
return Error("'key' field must be string or scalar type");
|
||||
}
|
||||
}
|
||||
|
||||
field->native_inline = field->attributes.Lookup("native_inline") != nullptr;
|
||||
if (field->native_inline && !IsStruct(field->value.type))
|
||||
return Error("native_inline can only be defined on structs'");
|
||||
|
||||
auto nested = field->attributes.Lookup("nested_flatbuffer");
|
||||
if (nested) {
|
||||
if (nested->type.base_type != BASE_TYPE_STRING)
|
||||
@@ -1758,9 +1763,6 @@ CheckedError Parser::SkipAnyJsonValue() {
|
||||
case kTokenFloatConstant:
|
||||
EXPECT(kTokenFloatConstant);
|
||||
break;
|
||||
case kTokenNull:
|
||||
EXPECT(kTokenNull);
|
||||
break;
|
||||
default:
|
||||
return Error(std::string("Unexpected token:") + std::string(1, static_cast<char>(token_)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user