[JVM_IR] Generate line numbers and nops for init blocks.

This seems to be what JVM does and it allows you to set a
breakpoint on the init line.
This commit is contained in:
Mads Ager
2020-05-28 14:27:38 +02:00
committed by max-kammerer
parent 85e2392fef
commit dc34d355bc
6 changed files with 97 additions and 6 deletions
+52
View File
@@ -0,0 +1,52 @@
// FILE: test.kt
class A {
companion object {
val s: String
init {
s = "OK"
}
val x = x()
init { val a = 32 }
init {
val b = 42
}
init
{
val c = 43
}
}
}
fun x() = ""
fun box() {
A.x
A.s
}
// JVM backend has extra steps for getX and getS.
// TODO: since these tests operate as step-into, we do not get any steps
// in the <clinit> for the companion object. Maybe extend the test infrastructure
// with directives to set break points in order to test this.
// LINENUMBERS
// test.kt:29 box
// test.kt:11 getX
// LINENUMBERS JVM
// test.kt:11 getX
// LINENUMBERS
// test.kt:29 box
// test.kt:30 box
// test.kt:5 getS
// LINENUMBERS JVM
// test.kt:5 getS
// LINENUMBERS
// test.kt:30 box
// test.kt:31 box