File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -470,6 +470,9 @@ int main(int argc, char* argv[])
470470 && (i.second ->GetChildType ()->GetChildType ()->IsSigned ());
471471 // Pointer returns will be automatically wrapped to return None on null pointer
472472 bool pointerResult = (i.second ->GetChildType ()->GetClass () == PointerTypeClass);
473+ // Enum returns will automatically cast to the enum type
474+ bool enumResult = (i.second ->GetChildType ()->GetClass () == NamedTypeReferenceClass
475+ && i.second ->GetChildType ()->GetNamedTypeReference ()->GetTypeReferenceClass () == EnumNamedTypeClass);
473476
474477 // From python -> C python3 requires str -> str.encode('charmap')
475478 bool swizzleArgs = true ;
@@ -617,6 +620,13 @@ int main(int argc, char* argv[])
617620 fprintf (out, " \t\t return None\n " );
618621 fprintf (out, " \t return result\n " );
619622 }
623+ else if (enumResult)
624+ {
625+ // Emit wrapper to cast result to enum type
626+ fprintf (out, " \t return " );
627+ OutputSwizzledType (out, i.second ->GetChildType ().GetValue ());
628+ fprintf (out, " (%s)" , stringArgFuncCall.c_str ());
629+ }
620630 else
621631 {
622632 fprintf (out, " \t return " );
You can’t perform that action at this time.
0 commit comments