@@ -24,6 +24,37 @@ private module FinalInstruction {
2424 Type getDeclaringType ( ) { result = super .getDeclaringType ( ) }
2525
2626 predicate isPublic ( ) { super .isPublic ( ) }
27+
28+ /**
29+ * Gets the fully qualified name of this method in the format:
30+ * "Namespace.ClassName.MethodName".
31+ *
32+ * If no declaring type exists, only the method name is returned.
33+ */
34+ string getFullyQualifiedName ( ) {
35+ exists ( Type t | t = this .getDeclaringType ( ) | result = t .getFullName ( ) + "." + this .getName ( ) )
36+ or
37+ not exists ( this .getDeclaringType ( ) ) and
38+ result = this .getName ( )
39+ }
40+
41+ /**
42+ * Holds if this method matches the given namespace, class name, and method name.
43+ *
44+ * If no declaring type exists, `namespace = className = ""`.
45+ */
46+ predicate hasFullyQualifiedName ( string namespace , string className , string methodName ) {
47+ exists ( Type t | t = this .getDeclaringType ( ) |
48+ t .getNamespace ( ) = namespace and
49+ t .getName ( ) = className and
50+ this .getName ( ) = methodName
51+ )
52+ or
53+ not exists ( this .getDeclaringType ( ) ) and
54+ namespace = "" and
55+ className = "" and
56+ this .getName ( ) = methodName
57+ }
2758 }
2859
2960 class Type instanceof Instruction:: Type {
@@ -281,6 +312,13 @@ private module FinalInstruction {
281312 methodName = s .regexpCapture ( r , 3 )
282313 )
283314 }
315+
316+ string getFullyQualifiedName ( ) {
317+ exists ( string namespace , string className , string methodName |
318+ this .hasFullyQualifiedName ( namespace , className , methodName ) and
319+ result = namespace + "." + className + "." + methodName
320+ )
321+ }
284322 }
285323
286324 class SubInstruction extends BinaryInstruction instanceof Instruction:: SubInstruction { }
0 commit comments