@@ -34,9 +34,9 @@ module TypeResolution {
34
34
}
35
35
36
36
/**
37
- * Holds if `host` is a type with a `content` of type `memberType`.
37
+ * Holds if `host` is a type with a `content` of type `memberType`, not counting inherited members .
38
38
*/
39
- private predicate typeMember ( Node host , DataFlow:: Content content , Node memberType ) {
39
+ private predicate typeOwnMember ( Node host , DataFlow:: Content content , Node memberType ) {
40
40
exists ( MemberDeclaration decl | host = getMemberBase ( decl ) |
41
41
exists ( FieldDeclaration field |
42
42
decl = field and
@@ -46,8 +46,13 @@ module TypeResolution {
46
46
or
47
47
exists ( MethodDeclaration method |
48
48
decl = method and
49
- content .asPropertyName ( ) = method .getName ( ) and
49
+ content .asPropertyName ( ) = method .getName ( )
50
+ |
51
+ not method instanceof AccessorMethodDeclaration and
50
52
memberType = method .getBody ( ) // use the Function as representative for the function type
53
+ or
54
+ method instanceof GetterMethodDeclaration and
55
+ memberType = method .getBody ( ) .getReturnTypeAnnotation ( )
51
56
)
52
57
or
53
58
decl instanceof IndexSignature and
@@ -72,8 +77,16 @@ module TypeResolution {
72
77
memberType = type .getArgument ( 0 )
73
78
)
74
79
)
80
+ }
81
+
82
+ /**
83
+ * Holds if `host` is a type with a `content` of type `memberType`, possible due to inheritance.
84
+ */
85
+ private predicate typeMember ( Node host , DataFlow:: Content content , Node memberType ) {
86
+ typeOwnMember ( host , content , memberType )
75
87
or
76
88
// Inherit members from base types
89
+ not typeOwnMember ( host , content , _) and
77
90
exists ( ClassOrInterface baseType | typeMember ( baseType , content , memberType ) |
78
91
host .( ClassDefinition ) .getSuperClass ( ) = trackClassValue ( baseType )
79
92
or
0 commit comments