From 7cc72e4b11df064391a909ee7fa0ee5dd7630f9b Mon Sep 17 00:00:00 2001 From: Kamil Rojewski Date: Fri, 11 Aug 2017 18:19:28 +0200 Subject: [PATCH] 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 --- src/idl_parser.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index fc3f97b59..ade20413d 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");