@@ -10,11 +10,7 @@ class NamespaceDefinition extends Stmt, @namespacedefinition, AST::ValueNode {
1010 /**
1111 * Gets the identifier naming the namespace.
1212 */
13- Identifier getId ( ) {
14- result = this .( NamespaceDeclaration ) .getId ( )
15- or
16- result = this .( EnumDeclaration ) .getIdentifier ( )
17- }
13+ Identifier getIdentifier ( ) { none ( ) } // Overridden in subtypes.
1814
1915 /**
2016 * Gets unqualified name of the namespace being defined.
@@ -29,7 +25,7 @@ class NamespaceDefinition extends Stmt, @namespacedefinition, AST::ValueNode {
2925 * Gets the local namespace name induced by this namespace.
3026 */
3127 LocalNamespaceName getLocalNamespaceName ( ) {
32- result = getId ( ) .( LocalNamespaceDecl ) .getLocalNamespaceName ( )
28+ result = getIdentifier ( ) .( LocalNamespaceDecl ) .getLocalNamespaceName ( )
3329 }
3430
3531 /**
@@ -55,10 +51,10 @@ class NamespaceDefinition extends Stmt, @namespacedefinition, AST::ValueNode {
5551 */
5652class NamespaceDeclaration extends NamespaceDefinition , StmtContainer , @namespacedeclaration {
5753 /** Gets the name of this namespace. */
58- override Identifier getId ( ) { result = getChildExpr ( - 1 ) }
54+ override Identifier getIdentifier ( ) { result = getChildExpr ( - 1 ) }
5955
6056 /** Gets the name of this namespace as a string. */
61- override string getName ( ) { result = getId ( ) .getName ( ) }
57+ override string getName ( ) { result = getIdentifier ( ) .getName ( ) }
6258
6359 /** Gets the `i`th statement in this namespace. */
6460 Stmt getStmt ( int i ) {
@@ -83,7 +79,7 @@ class NamespaceDeclaration extends NamespaceDefinition, StmtContainer, @namespac
8379 predicate isInstantiated ( ) { isInstantiated ( this ) }
8480
8581 override ControlFlowNode getFirstControlFlowNode ( ) {
86- if hasDeclareKeyword ( this ) then result = this else result = getId ( )
82+ if hasDeclareKeyword ( this ) then result = this else result = getIdentifier ( )
8783 }
8884}
8985
@@ -179,12 +175,12 @@ class GlobalAugmentationDeclaration extends Stmt, StmtContainer, @globalaugmenta
179175/** A TypeScript "import-equals" declaration. */
180176class ImportEqualsDeclaration extends Stmt , @importequalsdeclaration {
181177 /** Gets the name under which the imported entity is imported. */
182- Identifier getId ( ) { result = getChildExpr ( 0 ) }
178+ Identifier getIdentifier ( ) { result = getChildExpr ( 0 ) }
183179
184180 /** Gets the expression specifying the imported module or entity. */
185181 Expr getImportedEntity ( ) { result = getChildExpr ( 1 ) }
186182
187- override ControlFlowNode getFirstControlFlowNode ( ) { result = getId ( ) }
183+ override ControlFlowNode getFirstControlFlowNode ( ) { result = getIdentifier ( ) }
188184}
189185
190186/**
@@ -348,7 +344,7 @@ class TypeDecl extends Identifier, TypeRef, LexicalDecl {
348344 this = any ( ClassOrInterface ci ) .getIdentifier ( ) or
349345 this = any ( TypeParameter tp ) .getIdentifier ( ) or
350346 this = any ( ImportSpecifier im ) .getLocal ( ) or
351- this = any ( ImportEqualsDeclaration im ) .getId ( ) or
347+ this = any ( ImportEqualsDeclaration im ) .getIdentifier ( ) or
352348 this = any ( TypeAliasDeclaration td ) .getIdentifier ( ) or
353349 this = any ( EnumDeclaration ed ) .getIdentifier ( ) or
354350 this = any ( EnumMember member ) .getIdentifier ( )
@@ -1226,8 +1222,8 @@ abstract class NamespaceRef extends ASTNode { }
12261222 */
12271223class LocalNamespaceDecl extends VarDecl , NamespaceRef {
12281224 LocalNamespaceDecl ( ) {
1229- any ( NamespaceDeclaration nd ) .getId ( ) = this or
1230- any ( ImportEqualsDeclaration im ) .getId ( ) = this or
1225+ any ( NamespaceDeclaration nd ) .getIdentifier ( ) = this or
1226+ any ( ImportEqualsDeclaration im ) .getIdentifier ( ) = this or
12311227 any ( ImportSpecifier im ) .getLocal ( ) = this or
12321228 any ( EnumDeclaration ed ) .getIdentifier ( ) = this
12331229 }
@@ -1325,7 +1321,7 @@ class ImportVarTypeAccess extends VarTypeAccess, ImportTypeExpr, @importvartypea
13251321 */
13261322class EnumDeclaration extends NamespaceDefinition , @enumdeclaration, AST:: ValueNode {
13271323 /** Gets the name of this enum, such as `E` in `enum E { A, B }`. */
1328- Identifier getIdentifier ( ) { result = getChildExpr ( 0 ) }
1324+ override Identifier getIdentifier ( ) { result = getChildExpr ( 0 ) }
13291325
13301326 /** Gets the name of this enum as a string. */
13311327 override string getName ( ) { result = getIdentifier ( ) .getName ( ) }
0 commit comments