File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed
src/codeql_ql/ast/internal Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -77,8 +77,12 @@ private module Cached {
77
77
p = t .getClassPredicate ( mc .getMemberName ( ) , mc .getNumberOfArguments ( ) )
78
78
)
79
79
or
80
- // super calls
81
- exists ( Super sup , ClassType type , Type supertype |
80
+ // super calls - and `this.method()` calls in charpreds. (Basically: in charpreds there is no difference between super and this.)
81
+ exists ( AstNode sup , ClassType type , Type supertype |
82
+ sup instanceof Super
83
+ or
84
+ sup .( ThisAccess ) .getEnclosingPredicate ( ) instanceof CharPred
85
+ |
82
86
mc .getBase ( ) = sup and
83
87
sup .getEnclosingPredicate ( ) .getParent ( ) .( Class ) .getType ( ) = type and
84
88
supertype in [ type .getASuperType ( ) , type .getAnInstanceofType ( ) ] and
Original file line number Diff line number Diff line change @@ -7,3 +7,28 @@ module Firebase {
7
7
8
8
int snapshot ( ) { result = 2 }
9
9
}
10
+
11
+ class Foo extends int {
12
+ Foo ( ) { this = 1 or this = 2 }
13
+ }
14
+
15
+ class Function extends int {
16
+ Function ( ) { this = 1 }
17
+
18
+ bindingset [ i]
19
+ int getParameter ( int i ) { result = i * this }
20
+ }
21
+
22
+ class Bar extends Foo instanceof Function {
23
+ Bar ( ) {
24
+ exists ( super .getParameter ( 0 ) )
25
+ or
26
+ exists ( this .getParameter ( 0 ) ) // <- we support this, until it's clear whether it's a compile error or not
27
+ }
28
+
29
+ predicate bar ( ) {
30
+ exists ( super .getParameter ( 0 ) )
31
+ // or
32
+ // exists(this.getParameter(0)) // <- this is definitely a compile error
33
+ }
34
+ }
Original file line number Diff line number Diff line change 1
1
getTarget
2
2
| Bar.qll:5:38:5:47 | PredicateCall | Bar.qll:8:3:8:31 | ClasslessPredicate snapshot |
3
+ | Bar.qll:24:12:24:32 | MemberCall | Bar.qll:19:3:19:47 | ClassPredicate getParameter |
4
+ | Bar.qll:26:12:26:31 | MemberCall | Bar.qll:19:3:19:47 | ClassPredicate getParameter |
5
+ | Bar.qll:30:12:30:32 | MemberCall | Bar.qll:19:3:19:47 | ClassPredicate getParameter |
3
6
| Baz.qll:8:18:8:44 | MemberCall | Baz.qll:4:3:4:37 | ClassPredicate getImportedPath |
4
7
| Foo.qll:5:26:5:30 | PredicateCall | Foo.qll:3:1:3:26 | ClasslessPredicate foo |
5
8
| Foo.qll:10:21:10:25 | PredicateCall | Foo.qll:8:3:8:28 | ClassPredicate bar |
You can’t perform that action at this time.
0 commit comments