@@ -898,17 +898,31 @@ class ClassNode extends DataFlow::SourceNode instanceof ClassNode::Range {
898
898
*/
899
899
FunctionNode getAnInstanceMember ( ) { result = super .getAnInstanceMember ( _) }
900
900
901
+ /**
902
+ * Gets the static method, getter, or setter declared in this class with the given name and kind.
903
+ */
904
+ FunctionNode getStaticMember ( string name , MemberKind kind ) {
905
+ result = super .getStaticMember ( name , kind )
906
+ }
907
+
901
908
/**
902
909
* Gets the static method declared in this class with the given name.
903
910
*/
904
- FunctionNode getStaticMethod ( string name ) { result = super .getStaticMethod ( name ) }
911
+ FunctionNode getStaticMethod ( string name ) {
912
+ result = this .getStaticMember ( name , MemberKind:: method ( ) )
913
+ }
914
+
915
+ /**
916
+ * Gets a static method, getter, or setter declared in this class with the given kind.
917
+ */
918
+ FunctionNode getAStaticMember ( MemberKind kind ) { result = super .getAStaticMember ( kind ) }
905
919
906
920
/**
907
921
* Gets a static method declared in this class.
908
922
*
909
923
* The constructor is not considered a static method.
910
924
*/
911
- FunctionNode getAStaticMethod ( ) { result = super . getAStaticMethod ( ) }
925
+ FunctionNode getAStaticMethod ( ) { result = this . getAStaticMember ( MemberKind :: method ( ) ) }
912
926
913
927
/**
914
928
* Gets a dataflow node that refers to the superclass of this class.
@@ -1119,18 +1133,34 @@ module ClassNode {
1119
1133
abstract FunctionNode getAnInstanceMember ( MemberKind kind ) ;
1120
1134
1121
1135
/**
1136
+ * Gets the static member of this class with the given name and kind.
1137
+ */
1138
+ cached
1139
+ abstract FunctionNode getStaticMember ( string name , MemberKind kind ) ;
1140
+
1141
+ /**
1142
+ * DEPRECATED. Override `getStaticMember` instead.
1143
+ *
1122
1144
* Gets the static method of this class with the given name.
1123
1145
*/
1124
1146
cached
1125
- abstract FunctionNode getStaticMethod ( string name ) ;
1147
+ deprecated FunctionNode getStaticMethod ( string name ) { none ( ) }
1148
+
1149
+ /**
1150
+ * Gets a static member of this class of the given kind.
1151
+ */
1152
+ cached
1153
+ abstract FunctionNode getAStaticMember ( MemberKind kind ) ;
1126
1154
1127
1155
/**
1156
+ * DEPRECATED. Override `getAStaticMember` instead.
1157
+ *
1128
1158
* Gets a static method of this class.
1129
1159
*
1130
1160
* The constructor is not considered a static method.
1131
1161
*/
1132
1162
cached
1133
- abstract FunctionNode getAStaticMethod ( ) ;
1163
+ deprecated FunctionNode getAStaticMethod ( ) { none ( ) }
1134
1164
1135
1165
/**
1136
1166
* Gets a dataflow node representing a class to be used as the super-class
@@ -1186,23 +1216,27 @@ module ClassNode {
1186
1216
result = this .getConstructor ( ) .getReceiver ( ) .getAPropertySource ( )
1187
1217
}
1188
1218
1189
- override FunctionNode getStaticMethod ( string name ) {
1219
+ override FunctionNode getStaticMember ( string name , MemberKind kind ) {
1190
1220
exists ( MethodDeclaration method |
1191
1221
method = astNode .getMethod ( name ) and
1192
1222
method .isStatic ( ) and
1223
+ kind = MemberKind:: of ( method ) and
1193
1224
result = method .getBody ( ) .flow ( )
1194
1225
)
1195
1226
or
1227
+ kind .isMethod ( ) and
1196
1228
result = this .getAPropertySource ( name )
1197
1229
}
1198
1230
1199
- override FunctionNode getAStaticMethod ( ) {
1231
+ override FunctionNode getAStaticMember ( MemberKind kind ) {
1200
1232
exists ( MethodDeclaration method |
1201
1233
method = astNode .getAMethod ( ) and
1202
1234
method .isStatic ( ) and
1235
+ kind = MemberKind:: of ( method ) and
1203
1236
result = method .getBody ( ) .flow ( )
1204
1237
)
1205
1238
or
1239
+ kind .isMethod ( ) and
1206
1240
result = this .getAPropertySource ( )
1207
1241
}
1208
1242
@@ -1300,9 +1334,15 @@ module ClassNode {
1300
1334
)
1301
1335
}
1302
1336
1303
- override FunctionNode getStaticMethod ( string name ) { result = this .getAPropertySource ( name ) }
1337
+ override FunctionNode getStaticMember ( string name , MemberKind kind ) {
1338
+ kind .isMethod ( ) and
1339
+ result = this .getAPropertySource ( name )
1340
+ }
1304
1341
1305
- override FunctionNode getAStaticMethod ( ) { result = this .getAPropertySource ( ) }
1342
+ override FunctionNode getAStaticMember ( MemberKind kind ) {
1343
+ kind .isMethod ( ) and
1344
+ result = this .getAPropertySource ( )
1345
+ }
1306
1346
1307
1347
/**
1308
1348
* Gets a reference to the prototype of this class.
0 commit comments