diff options
author | Dan Ring <dfring@gmail.com> | 2015-11-21 19:49:33 -0500 |
---|---|---|
committer | Dan Ring <dfring@gmail.com> | 2016-06-14 18:41:33 -0400 |
commit | 1f8e3c13e6bbdedd30abc70db0e0cd6c538bf9d8 (patch) | |
tree | f51eba18796ec45c1e4f058285834f998ad8a630 /src/idl_gen_go.cpp | |
parent | 5a401aef57460a8a6c5b4e77dacea61a0085bbb5 (diff) | |
download | flatbuffers-1f8e3c13e6bbdedd30abc70db0e0cd6c538bf9d8.tar.gz flatbuffers-1f8e3c13e6bbdedd30abc70db0e0cd6c538bf9d8.tar.bz2 flatbuffers-1f8e3c13e6bbdedd30abc70db0e0cd6c538bf9d8.zip |
Emit GetRootAs methods for all types in Go and Python
Diffstat (limited to 'src/idl_gen_go.cpp')
-rw-r--r-- | src/idl_gen_go.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/idl_gen_go.cpp b/src/idl_gen_go.cpp index 5841e121..0c624240 100644 --- a/src/idl_gen_go.cpp +++ b/src/idl_gen_go.cpp @@ -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; } |