Constructors represented "as in Java".
TODO: extract nested initializers somehow.
This commit is contained in:
committed by
Dmitry Petrov
parent
57c1b3e0e2
commit
8528c23194
+38
@@ -0,0 +1,38 @@
|
||||
class TestInitVarFromParameter(var x: Int)
|
||||
|
||||
class TestInitVarInClass {
|
||||
var x = 0
|
||||
}
|
||||
|
||||
class TestInitVarInInitBlock {
|
||||
var x: Int
|
||||
init {
|
||||
x = 0
|
||||
}
|
||||
}
|
||||
|
||||
class TestInitVarWithCustomSetter {
|
||||
var x = 0
|
||||
set(value) { field = value }
|
||||
}
|
||||
|
||||
class TestInitVarWithCustomSetterWithExplicitCtor {
|
||||
var x: Int
|
||||
set(value) { field = value }
|
||||
|
||||
init {
|
||||
x = 0
|
||||
}
|
||||
|
||||
constructor()
|
||||
}
|
||||
|
||||
class TestInitVarWithCustomSetterInCtor {
|
||||
var x: Int set(value) {
|
||||
field = value
|
||||
}
|
||||
|
||||
constructor() {
|
||||
x = 42
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user