Kotlin: Stop useValueDeclaration returning fakeLabel

This commit is contained in:
Ian Lynagh
2022-03-29 12:56:50 +01:00
parent c5e73cd6df
commit 05c062da99
2 changed files with 8 additions and 4 deletions

View File

@@ -2401,7 +2401,9 @@ open class KotlinFileExtractor(
useValueParameter(owner, useFunction(owner.parent as IrFunction))
else
useValueDeclaration(owner)
tw.writeVariableBinding(id, vId)
if (vId != null) {
tw.writeVariableBinding(id, vId)
}
}
}
is IrGetField -> {
@@ -2489,7 +2491,9 @@ open class KotlinFileExtractor(
tw.writeExprs_varaccess(lhsId, lhsType.javaResult.id, id, 0)
tw.writeExprsKotlinType(lhsId, lhsType.kotlinResult.id)
val vId = useValueDeclaration(e.symbol.owner)
tw.writeVariableBinding(lhsId, vId)
if (vId != null) {
tw.writeVariableBinding(lhsId, vId)
}
extractExpressionExpr(inPlaceUpdateRhs ?: rhsValue, callable, id, 1, exprParent.enclosingStmt)
}
is IrSetField -> {

View File

@@ -1036,13 +1036,13 @@ open class KotlinUsesExtractor(
}
}
fun useValueDeclaration(d: IrValueDeclaration): Label<out DbVariable> =
fun useValueDeclaration(d: IrValueDeclaration): Label<out DbVariable>? =
when(d) {
is IrValueParameter -> useValueParameter(d, null)
is IrVariable -> useVariable(d)
else -> {
logger.error("Unrecognised IrValueDeclaration: " + d.javaClass)
fakeLabel()
null
}
}