mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Add PropertyRefExpr QL class, change extraction to use it, and add tests
This commit is contained in:
@@ -18,7 +18,7 @@ reflection.kt:
|
||||
# 48| 0: [MethodAccess] println(...)
|
||||
# 48| -1: [TypeAccess] ConsoleKt
|
||||
# 48| 0: [MethodAccess] get(...)
|
||||
# 48| -1: [ClassInstanceExpr] new (...)
|
||||
# 48| -1: [PropertyRefExpr] ...::...
|
||||
# 48| -4: [AnonymousClass] new KProperty1<String,Character>(...) { ... }
|
||||
# 48| 1: [Constructor]
|
||||
# 48| 5: [BlockStmt] { ... }
|
||||
@@ -36,7 +36,7 @@ reflection.kt:
|
||||
# 49| 0: [MethodAccess] println(...)
|
||||
# 49| -1: [TypeAccess] ConsoleKt
|
||||
# 49| 0: [MethodAccess] get(...)
|
||||
# 49| -1: [ClassInstanceExpr] new (...)
|
||||
# 49| -1: [PropertyRefExpr] ...::...
|
||||
# 49| -4: [AnonymousClass] new KProperty0<Character>(...) { ... }
|
||||
# 49| 1: [Constructor]
|
||||
#-----| 4: (Parameters)
|
||||
@@ -90,7 +90,7 @@ reflection.kt:
|
||||
# 6| -1: [VarAccess] ref
|
||||
# 8| 2: [LocalVariableDeclStmt] var ...;
|
||||
# 8| 1: [LocalVariableDeclExpr] x0
|
||||
# 8| 0: [ClassInstanceExpr] new (...)
|
||||
# 8| 0: [PropertyRefExpr] ...::...
|
||||
# 8| -4: [AnonymousClass] new KProperty1<C,Integer>(...) { ... }
|
||||
# 8| 1: [Constructor]
|
||||
# 8| 5: [BlockStmt] { ... }
|
||||
@@ -146,7 +146,7 @@ reflection.kt:
|
||||
# 12| 0: [VarAccess] x0
|
||||
# 13| 7: [LocalVariableDeclStmt] var ...;
|
||||
# 13| 1: [LocalVariableDeclExpr] x5
|
||||
# 13| 0: [ClassInstanceExpr] new (...)
|
||||
# 13| 0: [PropertyRefExpr] ...::...
|
||||
# 13| -4: [AnonymousClass] new KProperty0<Integer>(...) { ... }
|
||||
# 13| 1: [Constructor]
|
||||
#-----| 4: (Parameters)
|
||||
@@ -171,7 +171,7 @@ reflection.kt:
|
||||
# 13| -3: [TypeAccess] C
|
||||
# 15| 8: [LocalVariableDeclStmt] var ...;
|
||||
# 15| 1: [LocalVariableDeclExpr] y0
|
||||
# 15| 0: [ClassInstanceExpr] new (...)
|
||||
# 15| 0: [PropertyRefExpr] ...::...
|
||||
# 15| -4: [AnonymousClass] new KMutableProperty1<C,Integer>(...) { ... }
|
||||
# 15| 1: [Constructor]
|
||||
# 15| 5: [BlockStmt] { ... }
|
||||
@@ -239,7 +239,7 @@ reflection.kt:
|
||||
# 19| 0: [VarAccess] y0
|
||||
# 20| 13: [LocalVariableDeclStmt] var ...;
|
||||
# 20| 1: [LocalVariableDeclExpr] y5
|
||||
# 20| 0: [ClassInstanceExpr] new (...)
|
||||
# 20| 0: [PropertyRefExpr] ...::...
|
||||
# 20| -4: [AnonymousClass] new KMutableProperty0<Integer>(...) { ... }
|
||||
# 20| 1: [Constructor]
|
||||
#-----| 4: (Parameters)
|
||||
|
||||
@@ -34,3 +34,15 @@ invocation
|
||||
| reflection.kt:23:23:23:33 | get(...) | file://<external>/KProperty2.class:0:0:0:0 | get |
|
||||
| reflection.kt:48:30:48:39 | get(...) | file://<external>/KProperty1.class:0:0:0:0 | get |
|
||||
| reflection.kt:49:30:49:34 | get(...) | file://<external>/KProperty0.class:0:0:0:0 | get |
|
||||
functionReferences
|
||||
| reflection.kt:5:49:5:54 | ...::... | reflection.kt:5:49:5:54 | invoke | reflection.kt:27:9:27:33 | m |
|
||||
propertyGetReferences
|
||||
| reflection.kt:8:38:8:42 | ...::... | reflection.kt:8:38:8:42 | get | reflection.kt:8:38:8:42 | get |
|
||||
| reflection.kt:13:35:13:41 | ...::... | reflection.kt:13:35:13:41 | get | reflection.kt:13:35:13:41 | get |
|
||||
| reflection.kt:15:45:15:49 | ...::... | reflection.kt:15:45:15:49 | get | reflection.kt:15:45:15:49 | get |
|
||||
| reflection.kt:20:42:20:48 | ...::... | reflection.kt:20:42:20:48 | get | reflection.kt:20:42:20:48 | get |
|
||||
| reflection.kt:48:13:48:28 | ...::... | reflection.kt:48:13:48:28 | get | reflection.kt:48:13:48:28 | get |
|
||||
| reflection.kt:49:13:49:28 | ...::... | reflection.kt:49:13:49:28 | get | reflection.kt:49:13:49:28 | get |
|
||||
propertySetReferences
|
||||
| reflection.kt:15:45:15:49 | ...::... | reflection.kt:15:45:15:49 | set | reflection.kt:15:45:15:49 | set |
|
||||
| reflection.kt:20:42:20:48 | ...::... | reflection.kt:20:42:20:48 | set | reflection.kt:20:42:20:48 | set |
|
||||
|
||||
@@ -39,3 +39,18 @@ query predicate variableInitializerType(
|
||||
query predicate invocation(Call c, Callable callee) {
|
||||
c.getCallee() = callee and callee.getDeclaringType().getPackage().getName() = "kotlin.reflect"
|
||||
}
|
||||
|
||||
query predicate functionReferences(MemberRefExpr e, Method m, Callable c) {
|
||||
e.asMethod() = m and
|
||||
e.getReferencedCallable() = c
|
||||
}
|
||||
|
||||
query predicate propertyGetReferences(PropertyRefExpr e, Method m, Callable c) {
|
||||
e.asGetMethod() = m and
|
||||
e.getGetterCallable() = c
|
||||
}
|
||||
|
||||
query predicate propertySetReferences(PropertyRefExpr e, Method m, Callable c) {
|
||||
e.asSetMethod() = m and
|
||||
e.getSetterCallable() = c
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user