mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Kotlin: Fix handling of objects in external dependencies
This commit is contained in:
@@ -906,7 +906,7 @@ open class KotlinFileExtractor(
|
||||
if(!c.isNonCompanionObject) {
|
||||
logger.warn(Severity.ErrorSevere, "Using instance for non-object class")
|
||||
}
|
||||
val classId = useClassSource(c)
|
||||
val classId = useClassInstance(c, listOf()).classLabel
|
||||
val instanceName = "INSTANCE"
|
||||
val instanceLabel = "@\"field;{$classId};$instanceName\""
|
||||
val instanceId: Label<DbField> = tw.getLabelFor(instanceLabel)
|
||||
@@ -1657,20 +1657,15 @@ open class KotlinFileExtractor(
|
||||
// field that we are accessing here.
|
||||
val exprParent = parent.expr(e, callable)
|
||||
val c: IrClass = e.symbol.owner
|
||||
// TODO: If this is enabled for Unit then it currently makes tests fail
|
||||
if(c.name.asString() == "Unit") {
|
||||
logger.warnElement(Severity.ErrorSevere, "Unit object not handled yet", e)
|
||||
} else {
|
||||
val instance = useObjectClassInstance(c)
|
||||
val instance = useObjectClassInstance(c)
|
||||
|
||||
val id = tw.getFreshIdLabel<DbVaraccess>()
|
||||
val type = useType(e.type)
|
||||
val locId = tw.getLocation(e)
|
||||
tw.writeExprs_varaccess(id, type.javaResult.id, type.kotlinResult.id, exprParent.parent, exprParent.idx)
|
||||
tw.writeHasLocation(id, locId)
|
||||
val id = tw.getFreshIdLabel<DbVaraccess>()
|
||||
val type = useType(e.type)
|
||||
val locId = tw.getLocation(e)
|
||||
tw.writeExprs_varaccess(id, type.javaResult.id, type.kotlinResult.id, exprParent.parent, exprParent.idx)
|
||||
tw.writeHasLocation(id, locId)
|
||||
|
||||
tw.writeVariableBinding(id, instance.id)
|
||||
}
|
||||
tw.writeVariableBinding(id, instance.id)
|
||||
}
|
||||
else -> {
|
||||
logger.warnElement(Severity.ErrorSevere, "Unrecognised IrExpression: " + e.javaClass, e)
|
||||
|
||||
Reference in New Issue
Block a user