@@ -325,33 +325,49 @@ private predicate elementSpec(
325
325
summaryModel ( namespace , type , subtypes , name , signature , ext , _, _, _)
326
326
}
327
327
328
+ private predicate elementSpec (
329
+ string namespace , string type , boolean subtypes , string name , string signature , string ext ,
330
+ UnboundValueOrRefType t
331
+ ) {
332
+ elementSpec ( namespace , type , subtypes , name , signature , ext ) and
333
+ t .hasQualifiedName ( namespace , type )
334
+ }
335
+
328
336
private class UnboundValueOrRefType extends ValueOrRefType {
329
337
UnboundValueOrRefType ( ) { this .isUnboundDeclaration ( ) }
330
338
331
- UnboundValueOrRefType getASubTypeUnbound ( ) { result = this .getASubType ( ) .getUnboundDeclaration ( ) }
339
+ UnboundValueOrRefType getASubTypeUnbound ( ) {
340
+ exists ( Type t |
341
+ result .getABaseType ( ) = t and
342
+ this = t .getUnboundDeclaration ( )
343
+ )
344
+ }
332
345
}
333
346
334
- bindingset [ namespace, type, subtypes]
335
- private UnboundValueOrRefType interpretType ( string namespace , string type , boolean subtypes ) {
336
- exists ( UnboundValueOrRefType t |
337
- t .hasQualifiedName ( namespace , type ) and
338
- if subtypes = true then result = t .getASubTypeUnbound * ( ) else result = t
339
- )
340
- }
347
+ private class UnboundCallable extends Callable , Virtualizable {
348
+ UnboundCallable ( ) { this .isUnboundDeclaration ( ) }
341
349
342
- private Member interpretMember (
343
- string namespace , string type , boolean subtypes , string name , string signature
344
- ) {
345
- elementSpec ( namespace , type , subtypes , name , signature , _) and
346
- exists ( UnboundValueOrRefType t |
347
- t = interpretType ( namespace , type , subtypes ) and
348
- result .getDeclaringType ( ) = t and
349
- result .hasName ( name )
350
- )
350
+ predicate overridesOrImplementsUnbound ( UnboundCallable that ) {
351
+ exists ( Callable c |
352
+ this .overridesOrImplementsOrEquals ( c ) and
353
+ this != c and
354
+ that = c .getUnboundDeclaration ( )
355
+ )
356
+ }
351
357
}
352
358
353
359
private class InterpretedCallable extends Callable {
354
- InterpretedCallable ( ) { this = interpretMember ( _, _, _, _, _) }
360
+ InterpretedCallable ( ) {
361
+ exists ( UnboundValueOrRefType t , boolean subtypes , string name |
362
+ elementSpec ( _, _, subtypes , name , _, _, t ) and
363
+ this .hasName ( name )
364
+ |
365
+ this .getDeclaringType ( ) = t
366
+ or
367
+ subtypes = true and
368
+ this .getDeclaringType ( ) = t .getASubTypeUnbound + ( )
369
+ )
370
+ }
355
371
}
356
372
357
373
private string paramsStringPartA ( InterpretedCallable c , int i ) {
@@ -388,10 +404,13 @@ private string paramsString(InterpretedCallable c) {
388
404
private Element interpretElement0 (
389
405
string namespace , string type , boolean subtypes , string name , string signature
390
406
) {
391
- elementSpec ( namespace , type , subtypes , name , signature , _) and
392
- exists ( UnboundValueOrRefType t | t = interpretType ( namespace , type , subtypes ) |
407
+ exists ( UnboundValueOrRefType t | elementSpec ( namespace , type , subtypes , name , signature , _, t ) |
393
408
exists ( Member m |
394
- result = m and
409
+ (
410
+ result = m
411
+ or
412
+ subtypes = true and result .( UnboundCallable ) .overridesOrImplementsUnbound ( m )
413
+ ) and
395
414
m .getDeclaringType ( ) = t and
396
415
m .hasName ( name )
397
416
|
@@ -400,6 +419,12 @@ private Element interpretElement0(
400
419
paramsString ( m ) = signature
401
420
)
402
421
or
422
+ (
423
+ result = t
424
+ or
425
+ subtypes = true and
426
+ result = t .( UnboundValueOrRefType ) .getASubTypeUnbound + ( )
427
+ ) and
403
428
result = t and
404
429
name = "" and
405
430
signature = ""
0 commit comments