Add test for checking generated invoke/get/set visibility

This commit is contained in:
Tamas Vajk
2022-03-18 14:43:53 +01:00
committed by Ian Lynagh
parent 61b0efb401
commit 878352f69c
2 changed files with 7 additions and 0 deletions

View File

@@ -124,3 +124,4 @@ fieldAccessInsideInvocationMethods
| reflection.kt:99:14:99:29 | ...::... | reflection.kt:99:14:99:29 | new Function1<String,Inner<String>>(...) { ... } | reflection.kt:99:14:99:29 | invoke | reflection.kt:99:14:99:29 | this.<dispatchReceiver> |
| reflection.kt:109:17:109:27 | ...::... | reflection.kt:109:17:109:27 | new KMutableProperty0<Integer>(...) { ... } | reflection.kt:109:17:109:27 | get | reflection.kt:109:17:109:27 | this.<dispatchReceiver> |
| reflection.kt:109:17:109:27 | ...::... | reflection.kt:109:17:109:27 | new KMutableProperty0<Integer>(...) { ... } | reflection.kt:109:17:109:27 | set | reflection.kt:109:17:109:27 | this.<dispatchReceiver> |
memberVisibility

View File

@@ -80,3 +80,9 @@ query predicate fieldAccessInsideInvocationMethods(
m.getName() = ["invoke", "get", "set"] and
access.getEnclosingCallable() = m
}
query predicate memberVisibility(ClassInstanceExpr e, Method m, string modifier) {
(e instanceof MemberRefExpr or e instanceof PropertyRefExpr) and
e.getAnonymousClass().getAMethod() = m and
m.hasModifier(modifier)
}