[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:
+14
-4
@@ -51,10 +51,8 @@ fun box() {
|
||||
Zoo()
|
||||
}
|
||||
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// The JVM_IR does not generate code that will break on the line
|
||||
// containing the `init`, nor the exit from the `init`. It only
|
||||
// contains lines for the contents of the init blocks.
|
||||
// JVM_IR has an extra step back to the line of the class
|
||||
// declaration for the return in the constructor.
|
||||
|
||||
// LINENUMBERS
|
||||
// test.kt:48 box
|
||||
@@ -64,6 +62,9 @@ fun box() {
|
||||
// test.kt:45 x
|
||||
// test.kt:7 <init>
|
||||
// test.kt:8 <init>
|
||||
// LINENUMBERS JVM_IR
|
||||
// test.kt:3 <init>
|
||||
// LINENUMBERS
|
||||
// test.kt:48 box
|
||||
// test.kt:49 box
|
||||
// test.kt:11 <init>
|
||||
@@ -73,6 +74,9 @@ fun box() {
|
||||
// test.kt:16 <init>
|
||||
// test.kt:17 <init>
|
||||
// test.kt:18 <init>
|
||||
// LINENUMBERS JVM_IR
|
||||
// test.kt:11 <init>
|
||||
// LINENUMBERS
|
||||
// test.kt:49 box
|
||||
// test.kt:50 box
|
||||
// test.kt:21 <init>
|
||||
@@ -85,6 +89,9 @@ fun box() {
|
||||
// test.kt:28 <init>
|
||||
// test.kt:29 <init>
|
||||
// test.kt:30 <init>
|
||||
// LINENUMBERS JVM_IR
|
||||
// test.kt:21 <init>
|
||||
// LINENUMBERS
|
||||
// test.kt:50 box
|
||||
// test.kt:51 box
|
||||
// test.kt:33 <init>
|
||||
@@ -94,5 +101,8 @@ fun box() {
|
||||
// test.kt:39 <init>
|
||||
// test.kt:40 <init>
|
||||
// test.kt:42 <init>
|
||||
// LINENUMBERS JVM_IR
|
||||
// test.kt:33 <init>
|
||||
// LINENUMBERS
|
||||
// test.kt:51 box
|
||||
// test.kt:52 box
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user