"introduce backing property" intention

This commit is contained in:
Dmitry Jemerov
2015-09-23 22:00:36 +02:00
parent dadef12723
commit e1acc8744d
27 changed files with 337 additions and 4 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.IntroduceBackingPropertyIntention
@@ -0,0 +1,9 @@
class Foo {
var <caret>x = ""
get() = $x + "!"
set(value) { $x = value + "!" }
fun foo(): String {
return $x
}
}
@@ -0,0 +1,10 @@
class Foo {
private var _x = ""
var x: String
get() = _x + "!"
set(value) { _x = value + "!" }
fun foo(): String {
return _x
}
}
@@ -0,0 +1,3 @@
class Foo {
val <caret>x = ""
}
@@ -0,0 +1,5 @@
class Foo {
private val _x = ""
val x: String
get() = _x
}
@@ -0,0 +1,3 @@
class Foo {
var <caret>x = ""
}
@@ -0,0 +1,8 @@
class Foo {
private var _x = ""
var x: String
get() = _x
set(value) {
_x = value
}
}
@@ -0,0 +1,4 @@
class Foo {
val <caret>x = ""
get() = field + "!"
}
@@ -0,0 +1,5 @@
class Foo {
private val _x = ""
val x: String
get() = _x + "!"
}
@@ -0,0 +1,5 @@
class Foo {
var <caret>x = ""
get() = field + "!"
set(value) { field = value + "!" }
}
@@ -0,0 +1,6 @@
class Foo {
private var _x = ""
var x: String
get() = _x + "!"
set(value) { _x = value + "!" }
}