mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-07 05:47:36 +00:00
Fix issues with uint64 enums (#5265)
* Fix issues with uint64 enums - hide the implementation of enums from code generators - fix uint64 the issue in the cpp-generator - fix #5108 - new tests - enums with bit_flags attribute should be unsigned * Refine objectives of EnumDef's FindByValue and ReverseLookup methods - move EnumDef::ReverseLookup implementation to idl_parser.cpp - fix typos * Make the IsUInt64 method private
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
6cc30b3272
commit
b8ef8c1521
@@ -125,8 +125,7 @@ class PhpGenerator : public BaseGenerator {
|
||||
code += Indent + "const ";
|
||||
code += ev.name;
|
||||
code += " = ";
|
||||
code += NumToString(ev.value) + ";\n";
|
||||
(void)enum_def;
|
||||
code += enum_def.ToString(ev) + ";\n";
|
||||
}
|
||||
|
||||
// End enum code.
|
||||
@@ -875,8 +874,7 @@ class PhpGenerator : public BaseGenerator {
|
||||
|
||||
std::string GenDefaultValue(const Value &value) {
|
||||
if (value.type.enum_def) {
|
||||
if (auto val = value.type.enum_def->ReverseLookup(
|
||||
StringToInt(value.constant.c_str()), false)) {
|
||||
if (auto val = value.type.enum_def->FindByValue(value.constant)) {
|
||||
return WrapInNameSpace(*value.type.enum_def) + "::" + val->name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user