Descriptor renderer: add option to render function without return type

This commit is contained in:
Natalia Ukhorskaya
2015-07-22 16:36:44 +03:00
parent 346039d262
commit e4d5984cf0
3 changed files with 3 additions and 1 deletions
@@ -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)