New J2K: Add TypeElement.present() function
This commit is contained in:
committed by
Ilya Kirillov
parent
77713c1877
commit
ff700b5399
@@ -234,11 +234,10 @@ class NewCodeBuilder {
|
|||||||
ktProperty.modifierList.accept(this)
|
ktProperty.modifierList.accept(this)
|
||||||
|
|
||||||
printer.printWithNoIndent(" ", ktProperty.name.value)
|
printer.printWithNoIndent(" ", ktProperty.name.value)
|
||||||
if (ktProperty.type.type != JKNoTypeImpl) {
|
if (ktProperty.type.present()) {
|
||||||
printer.printWithNoIndent(":")
|
printer.printWithNoIndent(":")
|
||||||
ktProperty.type.accept(this)
|
ktProperty.type.accept(this)
|
||||||
}
|
}
|
||||||
ktProperty.type.accept(this)
|
|
||||||
if (ktProperty.initializer !is JKStubExpression) {
|
if (ktProperty.initializer !is JKStubExpression) {
|
||||||
printer.printWithNoIndent(" = ")
|
printer.printWithNoIndent(" = ")
|
||||||
ktProperty.initializer.accept(this)
|
ktProperty.initializer.accept(this)
|
||||||
@@ -469,7 +468,7 @@ class NewCodeBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printer.printWithNoIndent(" ", localVariable.name.value)
|
printer.printWithNoIndent(" ", localVariable.name.value)
|
||||||
if (localVariable.type.type != JKContextType && localVariable.type.type !is JKNoTypeImpl) {
|
if (localVariable.type.present() && localVariable.type.type != JKContextType) {
|
||||||
printer.printWithNoIndent(": ")
|
printer.printWithNoIndent(": ")
|
||||||
localVariable.type.accept(this)
|
localVariable.type.accept(this)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -468,3 +468,6 @@ class JKTypeParameterTypeImpl(
|
|||||||
override val name: String,
|
override val name: String,
|
||||||
override val nullability: Nullability = Nullability.Default
|
override val nullability: Nullability = Nullability.Default
|
||||||
) : JKTypeParameterType
|
) : JKTypeParameterType
|
||||||
|
|
||||||
|
fun JKTypeElement.present(): Boolean =
|
||||||
|
type != JKNoTypeImpl
|
||||||
Reference in New Issue
Block a user