@@ -19,27 +19,53 @@ private import swift
19
19
class TypeDecl extends Generated:: TypeDecl {
20
20
override string toString ( ) { result = this .getName ( ) }
21
21
22
+ /**
23
+ * Gets the `index`th base type of this type declaration (0-based).
24
+ *
25
+ * This is the same as `getImmediateInheritedType`.
26
+ * DEPRECATED: either use `getImmediateInheritedType` or unindexed `getABaseType`.
27
+ */
28
+ deprecated Type getImmediateBaseType ( int index ) { result = this .getImmediateInheritedType ( index ) }
29
+
30
+ /**
31
+ * Gets the `index`th base type of this type declaration (0-based).
32
+ * This is the same as `getInheritedType`.
33
+ * DEPRECATED: use `getInheritedType` or unindexed `getABaseType`.
34
+ */
35
+ deprecated Type getBaseType ( int index ) { result = this .getInheritedType ( index ) }
36
+
37
+ /**
38
+ * Gets any of the base types of this type declaration.
39
+ */
40
+ Type getABaseType ( ) {
41
+ // TODO generalize this to resolve `TypeAliasDecl`s and consider bases added by extensions
42
+ result = this .getAnInheritedType ( )
43
+ }
44
+
22
45
/**
23
46
* Gets the declaration of the `index`th base type of this type declaration (0-based).
47
+ * DEPRECATED: The index is not very meaningful here. Use `getABaseTypeDecl`.
24
48
*/
25
- TypeDecl getBaseTypeDecl ( int i ) { result = this .getBaseType ( i ) .( AnyGenericType ) .getDeclaration ( ) }
49
+ deprecated TypeDecl getBaseTypeDecl ( int i ) {
50
+ result = this .getBaseType ( i ) .( AnyGenericType ) .getDeclaration ( )
51
+ }
26
52
27
53
/**
28
54
* Gets the declaration of any of the base types of this type declaration.
29
55
*/
30
- TypeDecl getABaseTypeDecl ( ) { result = this .getBaseTypeDecl ( _ ) }
56
+ TypeDecl getABaseTypeDecl ( ) { result = this .getABaseType ( ) . ( AnyGenericType ) . getDeclaration ( ) }
31
57
32
58
/**
33
59
* Gets a declaration that has this type as its `index`th base type.
34
60
*
35
- * DEPRECATED: The index is not very meaningful here. Use `getADerivedTypeDecl` or `getBaseTypeDecl `.
61
+ * DEPRECATED: The index is not very meaningful here. Use `getADerivedTypeDecl` or `getABaseTypeDecl `.
36
62
*/
37
63
deprecated TypeDecl getDerivedTypeDecl ( int i ) { result .getBaseTypeDecl ( i ) = this }
38
64
39
65
/**
40
66
* Gets the declaration of any type derived from this type declaration.
41
67
*/
42
- TypeDecl getADerivedTypeDecl ( ) { result .getBaseTypeDecl ( _ ) = this }
68
+ TypeDecl getADerivedTypeDecl ( ) { result .getABaseTypeDecl ( ) = this }
43
69
44
70
/**
45
71
* Gets the full name of this `TypeDecl`. For example in:
0 commit comments