Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b599ff2

Browse files
tamasvajkigfoo
authored andcommitted
Change variable location extraction
1 parent 75e4b6c commit b599ff2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,12 @@ open class KotlinFileExtractor(
626626
}
627627

628628
private fun getVariableLocationProvider(v: IrVariable): IrElement {
629-
if (v.origin == IrDeclarationOrigin.IR_TEMPORARY_VARIABLE) {
630-
return v.initializer ?: v
629+
val init = v.initializer
630+
if (v.startOffset < 0 && init != null) {
631+
// IR_TEMPORARY_VARIABLEs have no proper location
632+
return init
631633
}
634+
632635
return v
633636
}
634637

0 commit comments

Comments
 (0)