mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-26 08:02:41 +00:00
Use enum types in generated read/mutate methods for Go (#4978)
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
7c3c027295
commit
a4c362a1ba
@@ -675,7 +675,7 @@ static std::string GenGetter(const Type &type) {
|
||||
case BASE_TYPE_STRING: return "rcv._tab.ByteVector";
|
||||
case BASE_TYPE_UNION: return "rcv._tab.Union";
|
||||
case BASE_TYPE_VECTOR: return GenGetter(type.VectorType());
|
||||
default: return "rcv._tab.Get" + MakeCamel(GenTypeGet(type));
|
||||
default: return "rcv._tab.Get" + MakeCamel(GenTypeBasic(type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,6 +711,9 @@ static std::string GenTypePointer(const Type &type) {
|
||||
}
|
||||
|
||||
static std::string GenTypeGet(const Type &type) {
|
||||
if (type.enum_def != nullptr && !type.enum_def->is_union) {
|
||||
return GetEnumTypeName(*type.enum_def);
|
||||
}
|
||||
return IsScalar(type.base_type) ? GenTypeBasic(type) : GenTypePointer(type);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user