@@ -79,7 +79,10 @@ class Namespace extends NameQualifyingElement, @namespace {
7979 /** Gets the metric namespace. */
8080 MetricNamespace getMetrics ( ) { result = this }
8181
82- override string toString ( ) { result = this .getQualifiedName ( ) }
82+ /** Gets a version of the `QualifiedName` that is more suitable for display purposes. */
83+ string getFriendlyName ( ) { result = this .getQualifiedName ( ) }
84+
85+ final override string toString ( ) { result = getFriendlyName ( ) }
8386
8487 /** Gets a declaration of (part of) this namespace. */
8588 NamespaceDeclarationEntry getADeclarationEntry ( ) { result .getNamespace ( ) = this }
@@ -104,7 +107,7 @@ class NamespaceDeclarationEntry extends Locatable, @namespace_decl {
104107 namespace_decls ( underlyingElement ( this ) , unresolveElement ( result ) , _, _)
105108 }
106109
107- override string toString ( ) { result = this .getNamespace ( ) .toString ( ) }
110+ override string toString ( ) { result = this .getNamespace ( ) .getFriendlyName ( ) }
108111
109112 /**
110113 * Gets the location of the token preceding the namespace declaration
@@ -150,7 +153,7 @@ class UsingDeclarationEntry extends UsingEntry {
150153 */
151154 Declaration getDeclaration ( ) { usings ( underlyingElement ( this ) , unresolveElement ( result ) , _) }
152155
153- override string toString ( ) { result = "using " + this . getDeclaration ( ) . toString ( ) }
156+ override string toString ( ) { result = "using declaration" }
154157}
155158
156159/**
@@ -169,7 +172,9 @@ class UsingDirectiveEntry extends UsingEntry {
169172 */
170173 Namespace getNamespace ( ) { usings ( underlyingElement ( this ) , unresolveElement ( result ) , _) }
171174
172- override string toString ( ) { result = "using namespace " + this .getNamespace ( ) .toString ( ) }
175+ override string toString ( ) {
176+ result = "using namespace " + this .getNamespace ( ) .getFriendlyName ( )
177+ }
173178}
174179
175180/**
@@ -204,7 +209,7 @@ class GlobalNamespace extends Namespace {
204209 */
205210 deprecated string getFullName ( ) { result = this .getName ( ) }
206211
207- override string toString ( ) { result = "(global namespace)" }
212+ override string getFriendlyName ( ) { result = "(global namespace)" }
208213}
209214
210215/**
0 commit comments