Descriptor renderer: add option to render function without return type
This commit is contained in:
@@ -156,6 +156,7 @@ public interface DescriptorRendererOptions {
|
||||
public var classWithPrimaryConstructor: Boolean
|
||||
public var verbose: Boolean
|
||||
public var unitReturnType: Boolean
|
||||
public var withoutReturnType: Boolean
|
||||
public var normalizedVisibilities: Boolean
|
||||
public var showInternalKeyword: Boolean
|
||||
public var prettyFunctionTypes: Boolean
|
||||
|
||||
@@ -543,7 +543,7 @@ internal class DescriptorRendererImpl(
|
||||
renderReceiverAfterName(function, builder)
|
||||
|
||||
val returnType = function.getReturnType()
|
||||
if (unitReturnType || (returnType == null || !KotlinBuiltIns.isUnit(returnType))) {
|
||||
if (!withoutReturnType && (unitReturnType || (returnType == null || !KotlinBuiltIns.isUnit(returnType)))) {
|
||||
builder.append(": ").append(if (returnType == null) "[NULL]" else escape(renderType(returnType)))
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ internal class DescriptorRendererOptionsImpl : DescriptorRendererOptions {
|
||||
override var classWithPrimaryConstructor by property(false)
|
||||
override var verbose by property(false)
|
||||
override var unitReturnType by property(true)
|
||||
override var withoutReturnType by property(false)
|
||||
override var normalizedVisibilities by property(false)
|
||||
override var showInternalKeyword by property(true)
|
||||
override var prettyFunctionTypes by property(true)
|
||||
|
||||
Reference in New Issue
Block a user