summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2017-08-14 09:22:12 -0700
committerWouter van Oortmerssen <aardappel@gmail.com>2017-08-14 09:28:14 -0700
commitdca33ddb75a035344cb6ea3e38b9123dcce9b5fd (patch)
tree5f926d22b22d2eb0b06df14cb9b7168522b42343
parent76744a434514297dabc38a6eee3fc5fa40db2924 (diff)
downloadflatbuffers-dca33ddb75a035344cb6ea3e38b9123dcce9b5fd.tar.gz
flatbuffers-dca33ddb75a035344cb6ea3e38b9123dcce9b5fd.tar.bz2
flatbuffers-dca33ddb75a035344cb6ea3e38b9123dcce9b5fd.zip
Fixed root_type leaking in from included files.
Change-Id: I9378e375901f8a883eaeb2182955d690c358ed4b Tested: on Linux.
-rw-r--r--src/idl_parser.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp
index 4fb29eac..213357d7 100644
--- a/src/idl_parser.cpp
+++ b/src/idl_parser.cpp
@@ -2216,6 +2216,9 @@ CheckedError Parser::DoParse(const char *source,
name.c_str()));
// We generally do not want to output code for any included files:
if (!opts.generate_all) MarkGenerated();
+ // Reset root type just in case the included file had one, and the
+ // parent doesn't.
+ root_struct_def_ = nullptr;
// This is the easiest way to continue this file after an include:
// instead of saving and restoring all the state, we simply start the
// file anew. This will cause it to encounter the same include