mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Handle more cases of qualified this references
This commit is contained in:
@@ -1934,17 +1934,27 @@ open class KotlinFileExtractor(
|
|||||||
tw.writeCallableEnclosingExpr(id, callable)
|
tw.writeCallableEnclosingExpr(id, callable)
|
||||||
tw.writeStatementEnclosingExpr(id, exprParent.enclosingStmt)
|
tw.writeStatementEnclosingExpr(id, exprParent.enclosingStmt)
|
||||||
|
|
||||||
|
|
||||||
|
fun extractTypeAccess(parent: IrClass){
|
||||||
|
extractTypeAccess(parent.typeWith(listOf()), locId, callable, id, 0, exprParent.enclosingStmt)
|
||||||
|
}
|
||||||
|
|
||||||
when(val ownerParent = owner.parent) {
|
when(val ownerParent = owner.parent) {
|
||||||
is IrFunction -> {
|
is IrFunction -> {
|
||||||
if (ownerParent.dispatchReceiverParameter == owner &&
|
if (ownerParent.dispatchReceiverParameter == owner &&
|
||||||
ownerParent.extensionReceiverParameter != null) {
|
ownerParent.extensionReceiverParameter != null) {
|
||||||
logger.errorElement("Function-qualifier for this", e)
|
|
||||||
|
val ownerParent2 = ownerParent.parent
|
||||||
|
if (ownerParent2 is IrClass){
|
||||||
|
extractTypeAccess(ownerParent2)
|
||||||
|
} else {
|
||||||
|
logger.errorElement("Unhandled qualifier for this", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is IrClass -> {
|
is IrClass -> {
|
||||||
if (ownerParent.thisReceiver == owner) {
|
if (ownerParent.thisReceiver == owner) {
|
||||||
// TODO: Type arguments
|
extractTypeAccess(ownerParent)
|
||||||
extractTypeAccess(ownerParent.typeWith(listOf()), locId, callable, id, 0, exprParent.enclosingStmt)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
| this.kt:20:42:20:45 | this | file://:0:0:0:0 | <none> |
|
| this.kt:20:42:20:45 | this | file://:0:0:0:0 | <none> |
|
||||||
| this.kt:24:34:24:37 | this | file://:0:0:0:0 | <none> |
|
| this.kt:24:34:24:37 | this | file://:0:0:0:0 | <none> |
|
||||||
| this.kt:29:38:29:41 | this | file://:0:0:0:0 | <none> |
|
| this.kt:29:38:29:41 | this | file://:0:0:0:0 | <none> |
|
||||||
| this.kt:30:29:30:38 | this | file://:0:0:0:0 | <none> |
|
| this.kt:30:29:30:38 | Inner.this | this.kt:30:29:30:38 | Inner |
|
||||||
| this.kt:31:29:31:38 | Outer.this | this.kt:31:29:31:38 | Outer |
|
| this.kt:31:29:31:38 | Outer.this | this.kt:31:29:31:38 | Outer |
|
||||||
| this.kt:32:38:32:54 | this | file://:0:0:0:0 | <none> |
|
| this.kt:32:38:32:54 | this | file://:0:0:0:0 | <none> |
|
||||||
| this.kt:37:13:37:22 | Outer.this | this.kt:37:13:37:22 | Outer |
|
| this.kt:37:13:37:22 | Outer.this | this.kt:37:13:37:22 | Outer |
|
||||||
|
|||||||
@@ -10,12 +10,15 @@ instAcc
|
|||||||
| variables.kt:21:11:21:15 | this |
|
| variables.kt:21:11:21:15 | this |
|
||||||
| variables.kt:24:9:24:9 | this |
|
| variables.kt:24:9:24:9 | this |
|
||||||
| variables.kt:25:9:25:9 | this |
|
| variables.kt:25:9:25:9 | this |
|
||||||
| variables.kt:26:9:26:12 | this |
|
| variables.kt:26:9:26:12 | C2.this |
|
||||||
| variables.kt:27:9:27:12 | this |
|
| variables.kt:27:9:27:12 | this |
|
||||||
| variables.kt:28:9:28:12 | this |
|
| variables.kt:28:9:28:12 | this |
|
||||||
| variables.kt:31:9:31:15 | this |
|
| variables.kt:31:9:31:15 | C2.this |
|
||||||
| variables.kt:32:9:32:15 | this |
|
| variables.kt:32:9:32:15 | C2.this |
|
||||||
| variables.kt:41:13:41:16 | this |
|
| variables.kt:41:13:41:16 | this |
|
||||||
| variables.kt:42:13:42:19 | C3.this |
|
| variables.kt:42:13:42:19 | C3.this |
|
||||||
instAccQualifier
|
instAccQualifier
|
||||||
|
| variables.kt:26:9:26:12 | C2.this | variables.kt:26:9:26:12 | C2 |
|
||||||
|
| variables.kt:31:9:31:15 | C2.this | variables.kt:31:9:31:15 | C2 |
|
||||||
|
| variables.kt:32:9:32:15 | C2.this | variables.kt:32:9:32:15 | C2 |
|
||||||
| variables.kt:42:13:42:19 | C3.this | variables.kt:42:13:42:19 | C3 |
|
| variables.kt:42:13:42:19 | C3.this | variables.kt:42:13:42:19 | C3 |
|
||||||
|
|||||||
Reference in New Issue
Block a user