Introduce Property: Initial support (properties with getter)

This commit is contained in:
Alexey Sedunov
2015-03-04 18:01:06 +03:00
parent 48914e70ff
commit 03fada71d7
36 changed files with 396 additions and 158 deletions
@@ -1,11 +0,0 @@
// PARAM_TYPES: kotlin.Int
// PARAM_DESCRIPTOR: val m: kotlin.Int defined in foo
// EXTRACT_AS_PROPERTY
val n: Int = 1
// SIBLING:
fun foo(): Int {
val m = 1
return <selection>n + m + 1</selection>
}
@@ -1,5 +1,5 @@
// WITH_RUNTIME
// OPTIONS: true, true, false
// OPTIONS: true, true, false, false
// PARAM_TYPES: kotlin.Int
// PARAM_TYPES: kotlin.Int
// PARAM_TYPES: kotlin.Int
@@ -1,5 +1,5 @@
// WITH_RUNTIME
// OPTIONS: true, true, false
// OPTIONS: true, true, false, false
// PARAM_TYPES: kotlin.Int
// PARAM_TYPES: kotlin.Int
// PARAM_TYPES: kotlin.Int
@@ -0,0 +1,9 @@
// EXTRACTION_TARGET: property with initializer
class A {
val i = 1
fun foo(): Int {
return <selection>1 + 2</selection>
}
}
@@ -0,0 +1,11 @@
// EXTRACTION_TARGET: property with initializer
class A {
val i = 1
fun foo(): Int {
return i1
}
private val i1 = 1 + 2
}
@@ -0,0 +1,7 @@
// EXTRACTION_TARGET: property with initializer
val i = 1
fun foo(): Int {
return <selection>1 + 2</selection>
}
@@ -0,0 +1,9 @@
// EXTRACTION_TARGET: property with initializer
val i = 1
fun foo(): Int {
return i1
}
private val i1 = 1 + 2
@@ -1,6 +1,4 @@
// EXTRACT_AS_PROPERTY
// EXTRACTION_TARGET: property with getter
fun foo(n: Int): Int {
// SIBLING:
return {<selection>n + 1</selection>}()
}
@@ -1,5 +1,4 @@
// EXTRACT_AS_PROPERTY
// SIBLING:
// EXTRACTION_TARGET: property with getter
fun foo() {
<selection>1 + 1</selection>
}
@@ -0,0 +1,9 @@
// EXTRACTION_TARGET: property with getter
class A {
fun foo(): Int {
<selection>val a = 1 + 2
val b = a*2</selection>
val c = b - 1
}
}
@@ -0,0 +1,15 @@
// EXTRACTION_TARGET: property with getter
class A {
fun foo(): Int {
val b = i
val c = b - 1
}
private val i: Int
get() {
val a = 1 + 2
val b = a * 2
return b
}
}
@@ -1,8 +1,7 @@
// EXTRACT_AS_PROPERTY
// EXTRACTION_TARGET: property with getter
class A(val n: Int = 1) {
val m: Int = 2
// SIBLING:
fun foo(): Int {
return <selection>m + n + 1</selection>
}
@@ -1,8 +1,7 @@
// EXTRACT_AS_PROPERTY
// EXTRACTION_TARGET: property with getter
class A(val n: Int = 1) {
val m: Int = 2
// SIBLING:
fun foo(): Int {
return i
}
@@ -1,8 +1,6 @@
// EXTRACT_AS_PROPERTY
// EXTRACTION_TARGET: property with getter
val n: Int = 1
// SIBLING:
fun foo(): Int {
return <selection>n + 1</selection>
}
@@ -1,8 +1,6 @@
// EXTRACT_AS_PROPERTY
// EXTRACTION_TARGET: property with getter
val n: Int = 1
// SIBLING:
fun foo(): Int {
return i
}
@@ -0,0 +1,7 @@
// EXTRACTION_TARGET: property with getter
val n: Int = 1
fun foo(): Int {
val m = 1
return <selection>n + m + 1</selection>
}