@@ -134,6 +134,9 @@ private module TrackInstanceInput implements CallGraphConstruction::InputSig {
134
134
or
135
135
start .asExpr ( ) .( CfgNodes:: ExprNodes:: TypeNameCfgNode ) .getTypeName ( ) = typename and
136
136
exact = true
137
+ or
138
+ start .asParameter ( ) .getStaticType ( ) = typename and
139
+ exact = false
137
140
}
138
141
139
142
newtype State = additional MkState ( string typename , Boolean exact ) { start0 ( _, typename , exact ) }
@@ -174,12 +177,20 @@ Node trackInstance(string typename, boolean exact) {
174
177
exact ) )
175
178
}
176
179
180
+ private Type getTypeWithName ( string s , boolean exact ) {
181
+ result .getName ( ) = s and
182
+ exact = true
183
+ or
184
+ result .getASubtype + ( ) .getName ( ) = s and
185
+ exact = false
186
+ }
187
+
177
188
private CfgScope getTargetInstance ( CfgNodes:: CallCfgNode call ) {
178
189
// TODO: Also match argument/parameter types
179
- exists ( Node receiver , string method , string typename , Type t |
190
+ exists ( Node receiver , string method , string typename , Type t , boolean exact |
180
191
qualifiedCall ( call , receiver , method ) and
181
- receiver = trackInstance ( typename , _ ) and
182
- t . getName ( ) = typename
192
+ receiver = trackInstance ( typename , exact ) and
193
+ t = getTypeWithName ( typename , exact )
183
194
|
184
195
if method = "new"
185
196
then result = t .getAConstructor ( ) .getBody ( )
0 commit comments