Slightly simplify code in enumDeclaration()
Don't bother with maybe_owned_dohptr, we can just use tdname directly at the cost of a single "if" at the end, so do it like this as it's more clear and shorter.
This commit is contained in:
parent
1087e250d6
commit
30bbb6ae1c
1 changed files with 6 additions and 7 deletions
|
|
@ -2410,8 +2410,7 @@ public:
|
|||
enum_decl = NewStringEmpty();
|
||||
|
||||
// Preserve the typedef if we have it in the input.
|
||||
maybe_owned_dohptr tdname;
|
||||
tdname.assign_non_owned(Getattr(n, "tdname"));
|
||||
String* const tdname = Getattr(n, "tdname");
|
||||
if (tdname) {
|
||||
Printv(enum_decl, "typedef ", NIL);
|
||||
}
|
||||
|
|
@ -2423,10 +2422,6 @@ public:
|
|||
enum_prefix = ns_prefix; // Possibly NULL, but that's fine.
|
||||
}
|
||||
|
||||
if (tdname && enum_prefix) {
|
||||
tdname.assign_owned(NewStringf("%s_%s", enum_prefix, tdname.get()));
|
||||
}
|
||||
|
||||
scoped_dohptr enumname;
|
||||
|
||||
// Unnamed enums may just have no name at all or have a synthesized invalid name of the form "$unnamedN$ which is indicated by "unnamed" attribute.
|
||||
|
|
@ -2461,7 +2456,11 @@ public:
|
|||
Printv(enum_decl, "\n}", NIL);
|
||||
|
||||
if (tdname) {
|
||||
Printv(enum_decl, " ", tdname.get(), NIL);
|
||||
if (enum_prefix) {
|
||||
Printv(enum_decl, " ", enum_prefix, "_", tdname, NIL);
|
||||
} else {
|
||||
Printv(enum_decl, " ", tdname, NIL);
|
||||
}
|
||||
}
|
||||
Printv(enum_decl, ";\n\n", NIL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue