Evaluate expression: support EE on method with expression body, on properties

#KT-5485 Fixed
This commit is contained in:
Natalia Ukhorskaya
2014-08-06 17:08:01 +04:00
parent 3a7f66b7eb
commit de7b6cb3a1
11 changed files with 300 additions and 24 deletions
@@ -0,0 +1,31 @@
package whenEntry
fun main(args: Array<String>) {
val a = 1
// EXPRESSION: a
// RESULT: 1: I
val b = when {
//Breakpoint!
a == 1 -> 1 + 1
else -> 1 + 2
}
// EXPRESSION: a
// RESULT: 1: I
val c = when {
//Breakpoint!
a == 1 -> { 1 + 1 }
else -> 1 + 2
}
// EXPRESSION: a
// RESULT: 1: I
val d = when {
//Breakpoint!
a == 1 -> {
1 + 1
}
else -> 1 + 2
}
}
@@ -0,0 +1,46 @@
package withoutBodyFunctions
import kotlin.properties.Delegates
// EXPRESSION: 1 + 1
// RESULT: 2: I
val aGet: Int
//Breakpoint!
get() = 1
// EXPRESSION: 1 + 2
// RESULT: 3: I
val aGet2: Int
//Breakpoint!
get() { return 1 }
fun fooWithBody(i: Int): Int {
// EXPRESSION: i
// RESULT: 2: I
//Breakpoint!
return i
}
// EXPRESSION: i
// RESULT: 2: I
//Breakpoint!
fun foo(i: Int) = i
// EXPRESSION: i
// RESULT: 2: I
//Breakpoint!
fun fooOneLine(i: Int): Int { return 1 }
// Cannot stop at this breakpoint - empty body
//Breakpoint!
fun fooEmpty(i: Int) {}
fun main(args: Array<String>) {
aGet
aGet2
fooWithBody(2)
foo(2)
fooOneLine(2)
fooEmpty(2)
}
@@ -0,0 +1,45 @@
package withoutBodyProperties
import kotlin.properties.Delegates
// EXPRESSION: 1 + 1
// RESULT: 2: I
//Breakpoint!
val a = 1
// EXPRESSION: 1 + 2
// RESULT: 3: I
//Breakpoint!
var aDelegate: Int by Delegates.notNull()
// EXPRESSION: 1 + 3
// RESULT: 4: I
//Breakpoint!
val aLambda = { 1 + 1 }
class A {
{
// EXPRESSION: i
// RESULT: 1: I
// EXPRESSION: i
// RESULT: 2: I
for (i in 1..2) {
//Breakpoint!
val a = 1
}
}
// EXPRESSION: 1 + 4
// RESULT: 5: I
//Breakpoint!
val prop = 1
}
fun main(args: Array<String>) {
a
aDelegate = 1
aLambda
A().prop
}
@@ -0,0 +1,14 @@
package withoutBodyTypeParameters
import kotlin.properties.Delegates
// EXPRESSION: i
// RESULT: instance of java.lang.Integer(id=ID): Ljava/lang/Integer;
//Breakpoint!
fun foo<T>(i: T) = i
fun run(i: () -> Int) = 1
fun main(args: Array<String>) {
foo(2)
}