Add line numbers for suspend function to enhance stepping (KT-16025)

Stop at function start on step into.
Step at function end on step out.

Both cases should actually be skipped by debugger, but this is postponed
till new backend generation for suspend functions is ready.

 #KT-16025 Fixed
This commit is contained in:
Nikolay Krasko
2017-03-23 16:31:46 +03:00
parent 8cfcd7e5a6
commit 0d5913287f
6 changed files with 113 additions and 8 deletions
@@ -0,0 +1,34 @@
package siSuspendFun
import forTests.builder
private fun foo(): Int {
return 42 // 8
}
// One line suspend wihtout doResume
suspend fun fourth() = foo() // 7
// Multiline suspend without doResume
suspend fun third() : Int? {
return fourth() // 6
}
// One line suspend with doResume
suspend fun second(): Int = third()?.let { return it } ?: 0 // 4 (FIX IT!) 5
// Multiline suspend with doResume
suspend fun first(): Int { // 2 (FIX IT!)
second() // 3
return 12
}
fun main(args: Array<String>) {
builder {
//Breakpoint!
first() // 1
foo()
}
}
// STEP_INTO: 7
@@ -0,0 +1,33 @@
package souSuspendFun
import forTests.builder
private fun foo(): Int {
//Breakpoint!
return 42 // 1
}
// One line suspend wihtout doResume
suspend fun fourth() = foo() // 2
// Multiline suspend without doResume
suspend fun third() : Int? {
return fourth() // 3
}
// One line suspend with doResume
suspend fun second(): Int = third()?.let { return it } ?: 0 // 4 5 (FIX IT)
// Multiline suspend with doResume
suspend fun first(): Int {
second() // 6
return 12
} // 7 (FIX IT)
fun main(args: Array<String>) {
builder {
first() // 8
}
}
// STEP_OUT: 7