mirror of
https://github.com/github/codeql.git
synced 2025-12-22 19:56:32 +01:00
Kotlin: Stop useValueDeclaration returning fakeLabel
This commit is contained in:
@@ -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 -> {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user