Skip to content

Commit 0958f3c

Browse files
committed
Kotlin: Do not skip writing of getter and setters if the local deligate is null
1 parent fd11b02 commit 0958f3c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,19 +2979,19 @@ open class KotlinFileExtractor(
29792979
// as a workaround to silence warnings for kotlin < 2.3 about the elvis
29802980
// operator being redundant.
29812981
// For Kotlin >= 2.3, the cast is redundant, so we need to silence that warning
2982-
29832982
@Suppress("USELESS_CAST")
2984-
val delegate = (s.delegate as IrVariable?) ?: run {
2985-
logger.errorElement("Local delegated property is missing delegate", s)
2986-
return
2987-
}
2988-
extractVariable(delegate, callable, blockId, 0)
2989-
2983+
val delegate = s.delegate as IrVariable?
29902984
val propId = tw.getFreshIdLabel<DbKt_property>()
2991-
tw.writeKtProperties(propId, s.name.asString())
2992-
tw.writeHasLocation(propId, locId)
2993-
tw.writeKtPropertyDelegates(propId, useVariable(delegate))
29942985

2986+
if (delegate == null) {
2987+
// This is not expected to happen, as the plugin hooks into the pipeline before IR lowering.
2988+
logger.errorElement("Local delegated property is missing delegate", s)
2989+
} else {
2990+
extractVariable(delegate, callable, blockId, 0)
2991+
tw.writeKtProperties(propId, s.name.asString())
2992+
tw.writeHasLocation(propId, locId)
2993+
tw.writeKtPropertyDelegates(propId, useVariable(delegate))
2994+
}
29952995
// Getter:
29962996
extractStatement(s.getter, callable, blockId, 1)
29972997
val getterLabel = getLocallyVisibleFunctionLabels(s.getter).function

0 commit comments

Comments
 (0)