@@ -269,7 +269,7 @@ private predicate elementSpec(
269
269
UnboundValueOrRefType t
270
270
) {
271
271
elementSpec ( namespace , type , subtypes , name , signature , ext ) and
272
- t . hasQualifiedName ( namespace , type )
272
+ QN :: hasQualifiedName ( t , namespace , type )
273
273
}
274
274
275
275
private class UnboundValueOrRefType extends ValueOrRefType {
@@ -299,19 +299,6 @@ class UnboundCallable extends Callable {
299
299
}
300
300
}
301
301
302
- private predicate hasName ( Declaration d , string name ) {
303
- d .( Operator ) .getFunctionName ( ) = name
304
- or
305
- not d instanceof Operator and
306
- d .hasName ( name )
307
- }
308
-
309
- pragma [ nomagic]
310
- private predicate callableSpecInfo ( Callable c , string namespace , string type , string name ) {
311
- c .getDeclaringType ( ) .hasQualifiedName ( namespace , type ) and
312
- hasName ( c , name )
313
- }
314
-
315
302
pragma [ nomagic]
316
303
private predicate subtypeSpecCandidate ( string name , UnboundValueOrRefType t ) {
317
304
exists ( UnboundValueOrRefType t0 |
@@ -322,14 +309,19 @@ private predicate subtypeSpecCandidate(string name, UnboundValueOrRefType t) {
322
309
323
310
pragma [ nomagic]
324
311
private predicate callableInfo ( Callable c , string name , UnboundValueOrRefType decl ) {
325
- hasName ( c , name ) and
326
- decl = c .getDeclaringType ( )
312
+ decl = c .getDeclaringType ( ) and
313
+ (
314
+ c .( Operator ) .getFunctionName ( ) = name
315
+ or
316
+ not c instanceof Operator and
317
+ c .hasName ( name )
318
+ )
327
319
}
328
320
329
321
private class InterpretedCallable extends Callable {
330
322
InterpretedCallable ( ) {
331
323
exists ( string namespace , string type , string name |
332
- callableSpecInfo ( this , namespace , type , name ) and
324
+ partialModel ( this , namespace , type , name , _ ) and
333
325
elementSpec ( namespace , type , _, name , _, _)
334
326
)
335
327
or
@@ -340,49 +332,16 @@ private class InterpretedCallable extends Callable {
340
332
}
341
333
}
342
334
343
- private string paramsStringPartA ( InterpretedCallable c , int i ) {
344
- i = - 1 and result = "("
345
- or
346
- exists ( int n |
347
- exists ( c .getParameter ( n ) ) and
348
- i = 2 * n - 1 and
349
- result = "," and
350
- n != 0
351
- )
352
- or
353
- i = 2 * c .getNumberOfParameters ( ) and result = ")"
354
- }
355
-
356
- private string paramsStringPartB ( InterpretedCallable c , int i ) {
357
- exists ( int n , string p , Type t |
358
- t = c .getParameter ( n ) .getType ( ) and
359
- i = 2 * n and
360
- result = p and
361
- p = t .getQualifiedName ( )
362
- )
363
- }
364
-
365
- private string paramsString ( InterpretedCallable c ) {
366
- result =
367
- strictconcat ( int i , string s |
368
- s in [ paramsStringPartA ( c , i ) , paramsStringPartB ( c , i ) ]
369
- |
370
- s order by i
371
- )
372
- }
373
-
374
- /** Gets the source/sink/summary/neutral base declaration corresponding to the supplied parameters. */
375
335
pragma [ nomagic]
376
336
Declaration interpretBaseDeclaration ( string namespace , string type , string name , string signature ) {
377
337
exists ( UnboundValueOrRefType t | elementSpec ( namespace , type , _, name , signature , _, t ) |
378
338
result =
379
339
any ( Declaration d |
380
- d .getDeclaringType ( ) = t and
381
- hasName ( d , name ) and
340
+ QN:: hasQualifiedName ( d , namespace , type , name ) and
382
341
(
383
342
signature = ""
384
343
or
385
- paramsString ( d ) = signature
344
+ signature = "(" + parameterQualifiedTypeNamesToString ( d ) + ")"
386
345
)
387
346
)
388
347
or
@@ -394,7 +353,7 @@ Declaration interpretBaseDeclaration(string namespace, string type, string name,
394
353
395
354
/** Gets the source/sink/summary/neutral element corresponding to the supplied parameters. */
396
355
pragma [ nomagic]
397
- Element interpretElement (
356
+ Declaration interpretElement (
398
357
string namespace , string type , boolean subtypes , string name , string signature , string ext
399
358
) {
400
359
elementSpec ( namespace , type , subtypes , name , signature , ext ) and
0 commit comments