Adapt changes from main repo:
converted enums contain name() method by Andrey Ponomarev
This commit is contained in:
committed by
Pavel V. Talanov
parent
01a1c75588
commit
8537254b6f
@@ -22,13 +22,14 @@ public open class Enum(converter : Converter,
|
|||||||
override fun needOpenModifier() = false
|
override fun needOpenModifier() = false
|
||||||
|
|
||||||
public override fun toKotlin() : String {
|
public override fun toKotlin() : String {
|
||||||
|
val primaryConstructorBody = primaryConstructorBodyToKotlin() ?: ""
|
||||||
return modifiersToKotlin() +
|
return modifiersToKotlin() +
|
||||||
"enum class " + name.toKotlin() +
|
"enum class " + name.toKotlin() +
|
||||||
primaryConstructorSignatureToKotlin() +
|
primaryConstructorSignatureToKotlin() +
|
||||||
typeParametersToKotlin() +
|
typeParametersToKotlin() +
|
||||||
implementTypesToKotlin() +
|
implementTypesToKotlin() +
|
||||||
" {\n" + membersExceptConstructors().toKotlin("\n") + "\n" +
|
" {\n" + membersExceptConstructors().toKotlin("\n") + "\n" +
|
||||||
primaryConstructorBodyToKotlin() +
|
(if (primaryConstructorBody.isEmpty()) "" else primaryConstructorBody + "\n") +
|
||||||
"\npublic fun name() : String { return \"\" }\npublic fun order() : Int { return 0 }\n}"
|
"}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,4 @@ return color
|
|||||||
{
|
{
|
||||||
color = _color
|
color = _color
|
||||||
}
|
}
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,2 @@
|
|||||||
enum class A {
|
enum class A {
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,2 @@
|
|||||||
enum class A : I {
|
enum class A : I {
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,2 @@
|
|||||||
enum class A : I0, I1, I2 {
|
enum class A : I0, I1, I2 {
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
enum class E {
|
enum class E {
|
||||||
I
|
I
|
||||||
private var name : String? = null
|
private var name : String? = null
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,4 @@ return code
|
|||||||
{
|
{
|
||||||
code = c
|
code = c
|
||||||
}
|
}
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,2 @@
|
|||||||
enum class Test {
|
enum class Test {
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,4 @@ BLUE
|
|||||||
override fun toString() : String? {
|
override fun toString() : String? {
|
||||||
return "COLOR"
|
return "COLOR"
|
||||||
}
|
}
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,4 @@ return code
|
|||||||
{
|
{
|
||||||
code = c
|
code = c
|
||||||
}
|
}
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,2 @@
|
|||||||
private enum class Test {
|
private enum class Test {
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,2 @@
|
|||||||
protected enum class Test {
|
protected enum class Test {
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,2 @@
|
|||||||
public enum class Test {
|
public enum class Test {
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,4 @@ BLUE
|
|||||||
public override fun run() : Unit {
|
public override fun run() : Unit {
|
||||||
System.out?.println("name()=" + name() + ", toString()=" + toString())
|
System.out?.println("name()=" + name() + ", toString()=" + toString())
|
||||||
}
|
}
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,4 @@ PENNY
|
|||||||
NICKEL
|
NICKEL
|
||||||
DIME
|
DIME
|
||||||
QUARTER
|
QUARTER
|
||||||
public fun name() : String { return "" }
|
|
||||||
public fun order() : Int { return 0 }
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user