Use enum types in generated read/mutate methods for Go (#4978)

This commit is contained in:
kostya-sh
2018-10-08 22:25:37 +01:00
committed by Wouter van Oortmerssen
parent 7c3c027295
commit a4c362a1ba
6 changed files with 16 additions and 9 deletions

View File

@@ -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);
}