Add support of Optional<T> scalars to C++ code generator (#6092)

This commit is contained in:
Vladimir Glavnyy
2020-09-19 02:51:17 +07:00
committed by GitHub
parent 6228b66d3d
commit 8c67b5b129
19 changed files with 2471 additions and 133 deletions

View File

@@ -1,5 +1,10 @@
namespace optional_scalars;
enum OptionalByte: byte {
None = 0,
One = 1,
}
// This table tests optional scalars in tables. It should be integrated with
// the main monster test once most languages support optional scalars.
table ScalarStuff {
@@ -41,4 +46,14 @@ table ScalarStuff {
just_bool: bool;
maybe_bool: bool = null;
default_bool: bool = true;
just_enum: OptionalByte;
// Rust code generator failed with optional<enum>
//maybe_enum: OptionalByte = null;
default_enum: OptionalByte = One;
}
root_type ScalarStuff;
file_identifier "NULL";
file_extension "mon";