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

Skip to content

Commit 05c062d

Browse files
committed
Kotlin: Stop useValueDeclaration returning fakeLabel
1 parent c5e73cd commit 05c062d

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,9 @@ open class KotlinFileExtractor(
24012401
useValueParameter(owner, useFunction(owner.parent as IrFunction))
24022402
else
24032403
useValueDeclaration(owner)
2404-
tw.writeVariableBinding(id, vId)
2404+
if (vId != null) {
2405+
tw.writeVariableBinding(id, vId)
2406+
}
24052407
}
24062408
}
24072409
is IrGetField -> {
@@ -2489,7 +2491,9 @@ open class KotlinFileExtractor(
24892491
tw.writeExprs_varaccess(lhsId, lhsType.javaResult.id, id, 0)
24902492
tw.writeExprsKotlinType(lhsId, lhsType.kotlinResult.id)
24912493
val vId = useValueDeclaration(e.symbol.owner)
2492-
tw.writeVariableBinding(lhsId, vId)
2494+
if (vId != null) {
2495+
tw.writeVariableBinding(lhsId, vId)
2496+
}
24932497
extractExpressionExpr(inPlaceUpdateRhs ?: rhsValue, callable, id, 1, exprParent.enclosingStmt)
24942498
}
24952499
is IrSetField -> {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,13 +1036,13 @@ open class KotlinUsesExtractor(
10361036
}
10371037
}
10381038

1039-
fun useValueDeclaration(d: IrValueDeclaration): Label<out DbVariable> =
1039+
fun useValueDeclaration(d: IrValueDeclaration): Label<out DbVariable>? =
10401040
when(d) {
10411041
is IrValueParameter -> useValueParameter(d, null)
10421042
is IrVariable -> useVariable(d)
10431043
else -> {
10441044
logger.error("Unrecognised IrValueDeclaration: " + d.javaClass)
1045-
fakeLabel()
1045+
null
10461046
}
10471047
}
10481048

0 commit comments

Comments
 (0)