mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-09 14:46:26 +00:00
Emit GetRootAs methods for all types in Go and Python
This commit is contained in:
@@ -509,13 +509,12 @@ static void GenTableBuilders(const StructDef &struct_def,
|
||||
|
||||
// Generate struct or table methods.
|
||||
static void GenStruct(const StructDef &struct_def,
|
||||
std::string *code_ptr,
|
||||
StructDef *root_struct_def) {
|
||||
std::string *code_ptr) {
|
||||
if (struct_def.generated) return;
|
||||
|
||||
GenComment(struct_def.doc_comment, code_ptr, nullptr);
|
||||
BeginClass(struct_def, code_ptr);
|
||||
if (&struct_def == root_struct_def) {
|
||||
if (!struct_def.fixed) {
|
||||
// Generate a special accessor for the table that has been declared as
|
||||
// the root type.
|
||||
NewRootTypeFromBuffer(struct_def, code_ptr);
|
||||
@@ -637,7 +636,7 @@ class GoGenerator : public BaseGenerator {
|
||||
for (auto it = parser_.structs_.vec.begin();
|
||||
it != parser_.structs_.vec.end(); ++it) {
|
||||
std::string declcode;
|
||||
go::GenStruct(**it, &declcode, parser_.root_struct_def_);
|
||||
go::GenStruct(**it, &declcode);
|
||||
if (!SaveType(**it, declcode, true)) return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user