-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fixed length arrays #3987
Fixed length arrays #3987
Changes from all commits
d95238f
7709b55
baed4b7
4633759
b949376
c4b7b38
40e16d0
1b2ed31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ enum BaseType : byte { | |
ULong, | ||
Float, | ||
Double, | ||
Array, | ||
String, | ||
Vector, | ||
Obj, // Used for tables & structs. | ||
|
@@ -29,6 +30,7 @@ enum BaseType : byte { | |
table Type { | ||
base_type:BaseType; | ||
element:BaseType = None; // Only if base_type == Vector. | ||
fixed_length:short = 0; // Only if base_type == Array. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, this is an incompatible change. has to be at the end, or use ids. or maybe reuse |
||
index:int = -1; // If base_type == Object, index into "objects" below. | ||
// If base_type == Union, UnionType, or integral derived | ||
// from an enum, index into "enums" below. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -731,6 +731,7 @@ void GenStruct(StructDef &struct_def, std::string *code_ptr) { | |
it != struct_def.fields.vec.end(); | ||
++it) { | ||
auto &field = **it; | ||
assert(field.value.type.base_type != BASE_TYPE_ARRAY); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. asserts just produce a crash for the user. if people start making schemas with arrays in them, then unsupported languages need to get a proper error message somehow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just print the error message and then use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's nicer to handle errors in a centralized location, so I'm afraid we're going to have to pass an error back. To make that simpler you can stick a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function for struct generation is out of generator class in go and python generators, so this function has not access to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you could improve the Python/Go generators while you're at it, that be best I guess. |
||
if (field.deprecated) continue; | ||
GenComment(field.doc_comment, code_ptr, &lang_.comment_config, " "); | ||
std::string type_name = GenTypeGet(field.value.type); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding it in the middle rather than at the end will break all reflection files out there.