forked from BigfootDev/flatbuffers
Fixed .proto translation making scalars into required fields.
Change-Id: If414d156b4e9bc7fead5f131823b2c419cdc4e2c Tested: on Linux.
This commit is contained in:
@@ -23,7 +23,7 @@ inline const char **EnumNamesColor() {
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameColor(Color e) { return EnumNamesColor()[e]; }
|
||||
inline const char *EnumNameColor(Color e) { return EnumNamesColor()[static_cast<int>(e)]; }
|
||||
|
||||
enum Any {
|
||||
Any_NONE = 0,
|
||||
@@ -35,7 +35,7 @@ inline const char **EnumNamesAny() {
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameAny(Any e) { return EnumNamesAny()[e]; }
|
||||
inline const char *EnumNameAny(Any e) { return EnumNamesAny()[static_cast<int>(e)]; }
|
||||
|
||||
inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *union_obj, Any type);
|
||||
|
||||
|
||||
@@ -1080,7 +1080,7 @@ void Parser::ParseProtoDecl() {
|
||||
Expect(kTokenIntegerConstant);
|
||||
auto &field = AddField(struct_def, name, type);
|
||||
field.doc_comment = field_comment;
|
||||
field.required = required;
|
||||
if (!IsScalar(type.base_type)) field.required = required;
|
||||
// See if there's a default specified.
|
||||
if (IsNext('[')) {
|
||||
if (attribute_ != "default") Error("\'default\' expected");
|
||||
|
||||
@@ -31,7 +31,7 @@ inline const char **EnumNamesColor() {
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameColor(Color e) { return EnumNamesColor()[e - Color_Red]; }
|
||||
inline const char *EnumNameColor(Color e) { return EnumNamesColor()[static_cast<int>(e) - static_cast<int>(Color_Red)]; }
|
||||
|
||||
enum Any {
|
||||
Any_NONE = 0,
|
||||
@@ -44,7 +44,7 @@ inline const char **EnumNamesAny() {
|
||||
return names;
|
||||
}
|
||||
|
||||
inline const char *EnumNameAny(Any e) { return EnumNamesAny()[e]; }
|
||||
inline const char *EnumNameAny(Any e) { return EnumNamesAny()[static_cast<int>(e)]; }
|
||||
|
||||
inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *union_obj, Any type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user