summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Rojewski <krojew@users.noreply.github.com>2017-08-11 18:19:28 +0200
committerWouter van Oortmerssen <wvo@google.com>2017-08-11 09:19:28 -0700
commit7cc72e4b11df064391a909ee7fa0ee5dd7630f9b (patch)
tree24c1f3cceff684ec80188d1fa55d7a54330d4d86
parenta6a3f5925393146e879ba03d919a3380b9af7994 (diff)
downloadflatbuffers-7cc72e4b11df064391a909ee7fa0ee5dd7630f9b.tar.gz
flatbuffers-7cc72e4b11df064391a909ee7fa0ee5dd7630f9b.tar.bz2
flatbuffers-7cc72e4b11df064391a909ee7fa0ee5dd7630f9b.zip
Copying required field to union type vector (#4407)
* Eclipse ignore * TypeScript support * Prefixing enums * Test results * Merged JS and TS generators * Fixed AppVeyor build problems * Fixed more AppVeyor build problems * Fixed more AppVeyor build problems * Changed TS flag to options struct * Storing options by value * Removed unneeded const * Re-export support for unions * Uint support * Casting bools to numbers for mutation * TS shell tests * Reverted generates js test file to original version * Backing up js tests and properly generating test data * Not importing flatbuffers for TS test generation * Not overwriting generated js for tests * AppVeyor test fixes * Generating the most strict TS code possible * Not returning null when creating vectors * Not returning null from struct contructors * Copying required field to union type vector * Removed unneccessary bool
-rw-r--r--src/idl_parser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp
index fc3f97b5..ade20413 100644
--- a/src/idl_parser.cpp
+++ b/src/idl_parser.cpp
@@ -745,6 +745,10 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
}
if (typefield) {
+ if (!IsScalar(typefield->value.type.base_type)) {
+ // this is a union vector field
+ typefield->required = field->required;
+ }
// 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).
auto attr = field->attributes.Lookup("id");