@@ -9,7 +9,17 @@ private import Implements
99private import TypeRef
1010private import commons.QualifiedName
1111
12- private module QualifiedNameInput implements QualifiedNameInputSig { }
12+ private module QualifiedNameInput implements QualifiedNameInputSig {
13+ string getUnboundGenericSuffix ( UnboundGeneric ug ) {
14+ result = "<" + strictconcat ( int i | exists ( ug .getTypeParameter ( i ) ) | "" , "," ) + ">"
15+ }
16+ }
17+
18+ private module FullyQualifiedNameInput implements QualifiedNameInputSig {
19+ string getUnboundGenericSuffix ( UnboundGeneric ug ) {
20+ result = "`" + ug .getNumberOfTypeParameters ( )
21+ }
22+ }
1323
1424/**
1525 * A declaration.
@@ -24,11 +34,17 @@ class Declaration extends DotNet::Declaration, Element, @declaration {
2434
2535 override string toString ( ) { result = this .getName ( ) }
2636
27- override predicate hasQualifiedName ( string qualifier , string name ) {
37+ deprecated override predicate hasQualifiedName ( string qualifier , string name ) {
2838 QualifiedName< QualifiedNameInput > :: hasQualifiedName ( this , qualifier , name )
2939 }
3040
41+ override predicate hasFullyQualifiedName ( string qualifier , string name ) {
42+ QualifiedName< FullyQualifiedNameInput > :: hasQualifiedName ( this , qualifier , name )
43+ }
44+
3145 /**
46+ * DEPRECATED: Use `getFullyQualifiedNameWithTypes` instead.
47+ *
3248 * Gets the fully qualified name of this declaration, including types, for example
3349 * the fully qualified name with types of `M` on line 3 is `N.C.M(int, string)` in
3450 *
@@ -40,7 +56,7 @@ class Declaration extends DotNet::Declaration, Element, @declaration {
4056 * }
4157 * ```
4258 */
43- string getQualifiedNameWithTypes ( ) {
59+ deprecated string getQualifiedNameWithTypes ( ) {
4460 exists ( string qual |
4561 qual = this .getDeclaringType ( ) .getQualifiedName ( ) and
4662 if this instanceof NestedType
@@ -49,6 +65,27 @@ class Declaration extends DotNet::Declaration, Element, @declaration {
4965 )
5066 }
5167
68+ /**
69+ * Gets the fully qualified name of this declaration, including types, for example
70+ * the fully qualified name with types of `M` on line 3 is `N.C.M(int, string)` in
71+ *
72+ * ```csharp
73+ * namespace N {
74+ * class C {
75+ * void M(int i, string s) { }
76+ * }
77+ * }
78+ * ```
79+ */
80+ string getFullyQualifiedNameWithTypes ( ) {
81+ exists ( string qual |
82+ qual = this .getDeclaringType ( ) .getFullyQualifiedName ( ) and
83+ if this instanceof NestedType
84+ then result = qual + "+" + this .toStringWithTypes ( )
85+ else result = qual + "." + this .toStringWithTypes ( )
86+ )
87+ }
88+
5289 /**
5390 * Holds if this declaration has been generated by the compiler, for example
5491 * implicit constructors or accessors.
@@ -207,9 +244,13 @@ class Member extends DotNet::Member, Modifiable, @member {
207244
208245 override predicate isFile ( ) { Modifiable .super .isFile ( ) }
209246
210- final override predicate hasQualifiedName ( string namespace , string type , string name ) {
247+ deprecated final override predicate hasQualifiedName ( string namespace , string type , string name ) {
211248 QualifiedName< QualifiedNameInput > :: hasQualifiedName ( this , namespace , type , name )
212249 }
250+
251+ final override predicate hasFullyQualifiedName ( string namespace , string type , string name ) {
252+ QualifiedName< FullyQualifiedNameInput > :: hasQualifiedName ( this , namespace , type , name )
253+ }
213254}
214255
215256private class TOverridable = @virtualizable or @callable_accessor;
0 commit comments