Commit 85faa46f authored by iceboy's avatar iceboy Committed by Wouter van Oortmerssen

Fix union escaping order. (#4722)

* Fix union escaping order.

Fixes #4712

* style
parent cc354ea3
...@@ -1638,7 +1638,9 @@ class CppGenerator : public BaseGenerator { ...@@ -1638,7 +1638,9 @@ class CppGenerator : public BaseGenerator {
auto full_struct_name = GetUnionElement(ev, true, true); auto full_struct_name = GetUnionElement(ev, true, true);
// @TODO: Mby make this decisions more universal? How? // @TODO: Mby make this decisions more universal? How?
code_.SetValue("U_GET_TYPE", Name(field) + UnionTypeFieldSuffix()); code_.SetValue(
"U_GET_TYPE",
EscapeKeyword(field.name + UnionTypeFieldSuffix()));
code_.SetValue( code_.SetValue(
"U_ELEMENT_TYPE", "U_ELEMENT_TYPE",
WrapInNameSpace(u->defined_namespace, GetEnumValUse(*u, ev))); WrapInNameSpace(u->defined_namespace, GetEnumValUse(*u, ev)));
...@@ -1994,8 +1996,9 @@ class CppGenerator : public BaseGenerator { ...@@ -1994,8 +1996,9 @@ class CppGenerator : public BaseGenerator {
std::string GenUnionUnpackVal(const FieldDef &afield, std::string GenUnionUnpackVal(const FieldDef &afield,
const char *vec_elem_access, const char *vec_elem_access,
const char *vec_type_access) { const char *vec_type_access) {
return afield.value.type.enum_def->name + "Union::UnPack(" + "_e" + return afield.value.type.enum_def->name +
vec_elem_access + ", " + Name(afield) + UnionTypeFieldSuffix() + "Union::UnPack(" + "_e" + vec_elem_access + ", " +
EscapeKeyword(afield.name + UnionTypeFieldSuffix()) +
"()" + vec_type_access + ", _resolver)"; "()" + vec_type_access + ", _resolver)";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment