mirror of
https://github.com/github/codeql.git
synced 2025-12-19 18:33:16 +01:00
Merge pull request #10274 from igfoo/igfoo/extractCall
Kotlin: Remove a cast in array iterator call extraction
This commit is contained in:
@@ -2184,13 +2184,18 @@ open class KotlinFileExtractor(
|
||||
if (dispatchReceiver == null) {
|
||||
logger.errorElement("No dispatch receiver found for array iterator call", c)
|
||||
} else {
|
||||
val typeArgs = (dispatchReceiver.type as IrSimpleType).arguments.map {
|
||||
when(it) {
|
||||
is IrTypeProjection -> it.type
|
||||
else -> pluginContext.irBuiltIns.anyNType
|
||||
val drType = dispatchReceiver.type
|
||||
if (drType !is IrSimpleType) {
|
||||
logger.errorElement("Dispatch receiver with unexpected type rep found for array iterator call: ${drType.javaClass}", c)
|
||||
} else {
|
||||
val typeArgs = drType.arguments.map {
|
||||
when(it) {
|
||||
is IrTypeProjection -> it.type
|
||||
else -> pluginContext.irBuiltIns.anyNType
|
||||
}
|
||||
}
|
||||
extractRawMethodAccess(iteratorFn, c, callable, parent, idx, enclosingStmt, listOf(c.dispatchReceiver), null, null, typeArgs)
|
||||
}
|
||||
extractRawMethodAccess(iteratorFn, c, callable, parent, idx, enclosingStmt, listOf(c.dispatchReceiver), null, null, typeArgs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user