KT-963 Add "constructor" after the latest field
This commit is contained in:
@@ -111,7 +111,7 @@ public class Converter {
|
|||||||
private static List<Field> getFinalOrWithEmptyInitializer(@NotNull List<? extends Field> fields) {
|
private static List<Field> getFinalOrWithEmptyInitializer(@NotNull List<? extends Field> fields) {
|
||||||
List<Field> result = new LinkedList<Field>();
|
List<Field> result = new LinkedList<Field>();
|
||||||
for (Field f : fields)
|
for (Field f : fields)
|
||||||
if (f.isFinal() || f.getInitializer().toKotlin().isEmpty())
|
if (f.isVal() || f.getInitializer().toKotlin().isEmpty())
|
||||||
result.add(f);
|
result.add(f);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,8 +174,8 @@ public class Class extends Member {
|
|||||||
@NotNull
|
@NotNull
|
||||||
String bodyToKotlin() {
|
String bodyToKotlin() {
|
||||||
return SPACE + "{" + N +
|
return SPACE + "{" + N +
|
||||||
primaryConstructorBodyToKotlin() + N +
|
|
||||||
AstUtil.joinNodes(getNonStatic(membersExceptConstructors()), N) + N +
|
AstUtil.joinNodes(getNonStatic(membersExceptConstructors()), N) + N +
|
||||||
|
primaryConstructorBodyToKotlin() + N +
|
||||||
classObjectToKotlin() + N +
|
classObjectToKotlin() + N +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ public class Enum extends Class {
|
|||||||
public String toKotlin() {
|
public String toKotlin() {
|
||||||
return modifiersToKotlin() + "enum class" + SPACE + myName.toKotlin() + primaryConstructorSignatureToKotlin() +
|
return modifiersToKotlin() + "enum class" + SPACE + myName.toKotlin() + primaryConstructorSignatureToKotlin() +
|
||||||
typeParametersToKotlin() + implementTypesToKotlin() + SPACE + "{" + N +
|
typeParametersToKotlin() + implementTypesToKotlin() + SPACE + "{" + N +
|
||||||
primaryConstructorBodyToKotlin() + N +
|
|
||||||
AstUtil.joinNodes(membersExceptConstructors(), N) + N +
|
AstUtil.joinNodes(membersExceptConstructors(), N) + N +
|
||||||
|
primaryConstructorBodyToKotlin() + N +
|
||||||
"public fun name() : String { return \"\" }" + N + // TODO : remove hack
|
"public fun name() : String { return \"\" }" + N + // TODO : remove hack
|
||||||
"public fun order() : Int { return 0 }" + N +
|
"public fun order() : Int { return 0 }" + N +
|
||||||
"}";
|
"}";
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package demo;
|
||||||
|
|
||||||
|
class C {
|
||||||
|
public C(int a) {
|
||||||
|
abc = a * 2;
|
||||||
|
}
|
||||||
|
int abc = 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user