@@ -134,6 +134,9 @@ private module TrackInstanceInput implements CallGraphConstruction::InputSig {
134134 or
135135 start .asExpr ( ) .( CfgNodes:: ExprNodes:: TypeNameCfgNode ) .getTypeName ( ) = typename and
136136 exact = true
137+ or
138+ start .asParameter ( ) .getStaticType ( ) = typename and
139+ exact = false
137140 }
138141
139142 newtype State = additional MkState ( string typename , Boolean exact ) { start0 ( _, typename , exact ) }
@@ -174,12 +177,20 @@ Node trackInstance(string typename, boolean exact) {
174177 exact ) )
175178}
176179
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+
177188private CfgScope getTargetInstance ( CfgNodes:: CallCfgNode call ) {
178189 // 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 |
180191 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 )
183194 |
184195 if method = "new"
185196 then result = t .getAConstructor ( ) .getBody ( )
0 commit comments