[ghidra-stubs] Handle void return type

This commit is contained in:
widberg
2025-07-31 14:08:47 -04:00
committed by Ryan Kurtz
parent 85a5401aa8
commit b928046d93

View File

@@ -225,6 +225,10 @@ final class PythonTypeStubMethod extends PythonTypeStubElement<ExecutableElement
}; };
} }
if (type.getKind() == TypeKind.VOID) {
return "None";
}
if (type instanceof DeclaredType dt) { if (type instanceof DeclaredType dt) {
Element element = dt.asElement(); Element element = dt.asElement();
if (element instanceof QualifiedNameable nameable) { if (element instanceof QualifiedNameable nameable) {
@@ -314,15 +318,13 @@ final class PythonTypeStubMethod extends PythonTypeStubElement<ExecutableElement
printer.print(")"); printer.print(")");
TypeMirror res = el.getReturnType(); TypeMirror res = el.getReturnType();
if (res.getKind() != TypeKind.VOID) { printer.print(" -> ");
printer.print(" -> "); String convertedType = convertResultType(res);
String convertedType = convertResultType(res); if (convertedType != null) {
if (convertedType != null) { printer.print(convertedType);
printer.print(convertedType); }
} else {
else { printer.print(sanitizeQualifiedName(res));
printer.print(sanitizeQualifiedName(res));
}
} }
} }