mirror of
https://github.com/github/codeql.git
synced 2025-12-24 20:56:33 +01:00
Kotlin: Fix array indexer extraction
This commit is contained in:
@@ -2185,7 +2185,7 @@ open class KotlinFileExtractor(
|
||||
}
|
||||
}
|
||||
}
|
||||
isFunction(target, "kotlin", "(some array type)", { isArrayType(it) }, "get") && c.origin == IrStatementOrigin.GET_ARRAY_ELEMENT -> {
|
||||
isFunction(target, "kotlin", "(some array type)", { isArrayType(it) }, "get") && c.origin == IrStatementOrigin.GET_ARRAY_ELEMENT && c.dispatchReceiver != null -> {
|
||||
val id = tw.getFreshIdLabel<DbArrayaccess>()
|
||||
val type = useType(c.type)
|
||||
tw.writeExprs_arrayaccess(id, type.javaResult.id, parent, idx)
|
||||
|
||||
@@ -18,8 +18,11 @@ test.kt:
|
||||
# 3| 1: [ExprStmt] <Expr>;
|
||||
# 3| 0: [ImplicitCoercionToUnitExpr] <implicit coercion to unit>
|
||||
# 3| 0: [TypeAccess] Unit
|
||||
# 3| 1: [ArrayAccess] ...[...]
|
||||
# 3| 1: [MethodAccess] get(...)
|
||||
# 3| -1: [TypeAccess] TestKt
|
||||
# 3| 0: [VarAccess] arr
|
||||
# 3| 1: [IntegerLiteral] 1
|
||||
# 3| 2: [IntegerLiteral] 2
|
||||
# 4| 2: [ExprStmt] <Expr>;
|
||||
# 4| 0: [ImplicitCoercionToUnitExpr] <implicit coercion to unit>
|
||||
# 4| 0: [TypeAccess] Unit
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
| test.kt:3:5:3:13 | Dispatch receiver not found |
|
||||
| test.kt:3:5:3:13 | Extra arguments found |
|
||||
|
||||
Reference in New Issue
Block a user