KT-564 Move "constructor body" to beginning of the class
This commit is contained in:
@@ -168,9 +168,9 @@ public class Class extends Member {
|
|||||||
|
|
||||||
String bodyToKotlin() {
|
String bodyToKotlin() {
|
||||||
return SPACE + "{" + N +
|
return SPACE + "{" + N +
|
||||||
|
primaryConstructorBodyToKotlin() + N +
|
||||||
AstUtil.joinNodes(getNonStatic(membersExceptConstructors()), N) + N +
|
AstUtil.joinNodes(getNonStatic(membersExceptConstructors()), N) + N +
|
||||||
classObjectToKotlin() + N +
|
classObjectToKotlin() + N +
|
||||||
primaryConstructorBodyToKotlin() + N +
|
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ public class Enum extends Class {
|
|||||||
public String toKotlin() {
|
public String toKotlin() {
|
||||||
return modifiersToKotlin() + "enum" + SPACE + myName.toKotlin() + primaryConstructorSignatureToKotlin() +
|
return modifiersToKotlin() + "enum" + SPACE + myName.toKotlin() + primaryConstructorSignatureToKotlin() +
|
||||||
typeParametersToKotlin() + implementTypesToKotlin() + SPACE + "{" + N +
|
typeParametersToKotlin() + implementTypesToKotlin() + SPACE + "{" + N +
|
||||||
AstUtil.joinNodes(membersExceptConstructors(), N) + N +
|
|
||||||
primaryConstructorBodyToKotlin() + N +
|
primaryConstructorBodyToKotlin() + N +
|
||||||
|
AstUtil.joinNodes(membersExceptConstructors(), N) + N +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
open class C(arg1 : Int) {
|
open class C(arg1 : Int) {
|
||||||
|
{
|
||||||
|
$myArg1 = arg1
|
||||||
|
$myArg2 = 0
|
||||||
|
$myArg3 = 0
|
||||||
|
}
|
||||||
val myArg1 : Int
|
val myArg1 : Int
|
||||||
var myArg2 : Int
|
var myArg2 : Int
|
||||||
var myArg3 : Int
|
var myArg3 : Int
|
||||||
@@ -16,11 +21,6 @@ __.myArg3 = 0
|
|||||||
return __
|
return __
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
|
||||||
$myArg1 = arg1
|
|
||||||
$myArg2 = 0
|
|
||||||
$myArg3 = 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public open class User() {
|
public open class User() {
|
||||||
class object {
|
class object {
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
namespace org.test.customer
|
namespace org.test.customer
|
||||||
open class Customer(first : String?, last : String?) {
|
open class Customer(first : String?, last : String?) {
|
||||||
|
{
|
||||||
|
doSmthBefore()
|
||||||
|
$_firstName = first
|
||||||
|
$_lastName = last
|
||||||
|
doSmthAfter()
|
||||||
|
}
|
||||||
public val _firstName : String?
|
public val _firstName : String?
|
||||||
public val _lastName : String?
|
public val _lastName : String?
|
||||||
open public fun getFirstName() : String? {
|
open public fun getFirstName() : String? {
|
||||||
@@ -12,12 +18,6 @@ open private fun doSmthBefore() : Unit {
|
|||||||
}
|
}
|
||||||
open private fun doSmthAfter() : Unit {
|
open private fun doSmthAfter() : Unit {
|
||||||
}
|
}
|
||||||
{
|
|
||||||
doSmthBefore()
|
|
||||||
$_firstName = first
|
|
||||||
$_lastName = last
|
|
||||||
doSmthAfter()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
open class CustomerBuilder() {
|
open class CustomerBuilder() {
|
||||||
public var _firstName : String? = "Homer"
|
public var _firstName : String? = "Homer"
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
public open class Identifier<T>(myName : T?, myHasDollar : Boolean) {
|
public open class Identifier<T>(myName : T?, myHasDollar : Boolean) {
|
||||||
|
{
|
||||||
|
$myName = myName
|
||||||
|
$myHasDollar = myHasDollar
|
||||||
|
}
|
||||||
private val myName : T?
|
private val myName : T?
|
||||||
private var myHasDollar : Boolean
|
private var myHasDollar : Boolean
|
||||||
private var myNullable : Boolean = true
|
private var myNullable : Boolean = true
|
||||||
@@ -21,10 +25,6 @@ __.myNullable = isNullable
|
|||||||
return __
|
return __
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
|
||||||
$myName = myName
|
|
||||||
$myHasDollar = myHasDollar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public open class User() {
|
public open class User() {
|
||||||
class object {
|
class object {
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
public open class Identifier(myName : String?, myHasDollar : Boolean) {
|
public open class Identifier(myName : String?, myHasDollar : Boolean) {
|
||||||
|
{
|
||||||
|
$myName = myName
|
||||||
|
$myHasDollar = myHasDollar
|
||||||
|
}
|
||||||
private val myName : String?
|
private val myName : String?
|
||||||
private var myHasDollar : Boolean
|
private var myHasDollar : Boolean
|
||||||
private var myNullable : Boolean = true
|
private var myNullable : Boolean = true
|
||||||
@@ -21,10 +25,6 @@ __.myNullable = isNullable
|
|||||||
return __
|
return __
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
|
||||||
$myName = myName
|
|
||||||
$myHasDollar = myHasDollar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public open class User() {
|
public open class User() {
|
||||||
class object {
|
class object {
|
||||||
|
|||||||
@@ -1,4 +1,14 @@
|
|||||||
public open class Test(myName : String?, a : Boolean, b : Double, c : Float, d : Long, e : Int, f : Short, g : Char) {
|
public open class Test(myName : String?, a : Boolean, b : Double, c : Float, d : Long, e : Int, f : Short, g : Char) {
|
||||||
|
{
|
||||||
|
$myName = myName
|
||||||
|
$a = a
|
||||||
|
$b = b
|
||||||
|
$c = c
|
||||||
|
$d = d
|
||||||
|
$e = e
|
||||||
|
$f = f
|
||||||
|
$g = g
|
||||||
|
}
|
||||||
private val myName : String?
|
private val myName : String?
|
||||||
private var a : Boolean
|
private var a : Boolean
|
||||||
private var b : Double
|
private var b : Double
|
||||||
@@ -20,16 +30,6 @@ open fun foo(n : String?) : String? {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
|
||||||
$myName = myName
|
|
||||||
$a = a
|
|
||||||
$b = b
|
|
||||||
$c = c
|
|
||||||
$d = d
|
|
||||||
$e = e
|
|
||||||
$f = f
|
|
||||||
$g = g
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public open class User() {
|
public open class User() {
|
||||||
class object {
|
class object {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
enum Color(c : Int) {
|
enum Color(c : Int) {
|
||||||
|
{
|
||||||
|
$code = c
|
||||||
|
}
|
||||||
private var code : Int
|
private var code : Int
|
||||||
open public fun getCode() : Int {
|
open public fun getCode() : Int {
|
||||||
return code
|
return code
|
||||||
}
|
}
|
||||||
{
|
|
||||||
$code = c
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,11 @@ open class `$$$$$`() {
|
|||||||
open class `$`() {
|
open class `$`() {
|
||||||
}
|
}
|
||||||
open class `$$`(`$$$$` : `$$$$$`?) : `$`() {
|
open class `$$`(`$$$$` : `$$$$$`?) : `$`() {
|
||||||
|
{
|
||||||
|
$`$$$` = `$$$$`
|
||||||
|
}
|
||||||
val `$$$` : `$$$$$`?
|
val `$$$` : `$$$$$`?
|
||||||
open public fun `$$$$$$`() : `$$$$$`? {
|
open public fun `$$$$$$`() : `$$$$$`? {
|
||||||
return `$$$`
|
return `$$$`
|
||||||
}
|
}
|
||||||
{
|
|
||||||
$`$$$` = `$$$$`
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
open class Base<T>(name : T?) {
|
open class Base<T>(name : T?) {
|
||||||
}
|
}
|
||||||
open class One<T, K>(name : T?, second : K?) : Base<T?>(name) {
|
open class One<T, K>(name : T?, second : K?) : Base<T?>(name) {
|
||||||
private var mySecond : K?
|
|
||||||
{
|
{
|
||||||
$mySecond = second
|
$mySecond = second
|
||||||
}
|
}
|
||||||
|
private var mySecond : K?
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,8 +1,8 @@
|
|||||||
open class Base(name : String?) {
|
open class Base(name : String?) {
|
||||||
}
|
}
|
||||||
open class One(name : String?, second : String?) : Base(name) {
|
open class One(name : String?, second : String?) : Base(name) {
|
||||||
private var mySecond : String?
|
|
||||||
{
|
{
|
||||||
$mySecond = second
|
$mySecond = second
|
||||||
}
|
}
|
||||||
|
private var mySecond : String?
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user