Skip to content

Commit 4a9e54b

Browse files
kunyavskiySpace Team
authored andcommitted
[WASM] Don't generate debug info on sets to temporary variables
This change is required to avoid break in debug info in the next commit. Currently, on evaluating an argument of an inline function, it is wrapped to a block without debug info. This is not intended usage. In fact, temporary variables should be transparent to debug info, as they are not part of the code, but rather an implementation detail. After this change, workaround in inliner is no more needed and would be removed in the next commit.
1 parent 8e8d8bc commit 4a9e54b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/ir2wasm/BodyGenerator.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,12 @@ class BodyGenerator(
15281528
val init = declaration.initializer!!
15291529
generateExpression(init)
15301530
val varName = functionContext.referenceLocal(declaration.symbol)
1531-
body.buildSetLocal(varName, init.getSourceLocation())
1531+
val location = if (declaration.origin == IrDeclarationOrigin.IR_TEMPORARY_VARIABLE) {
1532+
SourceLocation.NoLocation("Temporary variable")
1533+
} else {
1534+
init.getSourceLocation()
1535+
}
1536+
body.buildSetLocal(varName, location)
15321537
}
15331538

15341539
// Return true if function is recognized as intrinsic.

compiler/testData/debug/stepping/reorder.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ fun box() {
3838

3939
// EXPECTATIONS WASM
4040
// test.kt:8 $box (12)
41-
// test.kt:7 $box (12)
4241
// test.kt:13 $box (12)
4342
// test.kt:12 $box (12)
4443
// test.kt:7 $box (12)

0 commit comments

Comments
 (0)