mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
Fixed broken traits codegen for --scoped-enums.
Change-Id: I5f538d12ea37d11d2e239ddde32eefcdd91e347b Tested: on Linux.
This commit is contained in:
@@ -365,8 +365,8 @@ class CppGenerator : public BaseGenerator {
|
||||
}
|
||||
|
||||
static std::string GenEnumValDecl(const EnumDef &enum_def,
|
||||
const std::string &enum_val,
|
||||
const IDLOptions &opts) {
|
||||
const std::string &enum_val,
|
||||
const IDLOptions &opts) {
|
||||
return opts.prefixed_enums ? enum_def.name + "_" + enum_val : enum_val;
|
||||
}
|
||||
|
||||
@@ -532,9 +532,11 @@ class CppGenerator : public BaseGenerator {
|
||||
code += "template<typename T> struct " + enum_def.name + "Traits {\n";
|
||||
}
|
||||
else {
|
||||
code += "template<> struct " + enum_def.name + "Traits<" + WrapInNameSpace(*ev.struct_def) + "> {\n";
|
||||
code += "template<> struct " + enum_def.name + "Traits<" +
|
||||
WrapInNameSpace(*ev.struct_def) + "> {\n";
|
||||
}
|
||||
code += " static const " + enum_def.name + " enum_value = " + GenEnumValDecl(enum_def, ev.name, parser_.opts) + ";\n";
|
||||
code += " static const " + enum_def.name + " enum_value = " +
|
||||
GetEnumValUse(enum_def, ev, parser_.opts) + ";\n";
|
||||
code += "};\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user