Skip to content

Commit e294b8f

Browse files
committed
Swift: Add convenience member predicates to 'TypeDecl'.
1 parent 74cd532 commit e294b8f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
private import codeql.swift.generated.decl.TypeDecl
2+
private import codeql.swift.generated.type.Type
3+
private import codeql.swift.elements.type.AnyGenericType
24

35
class TypeDecl extends TypeDeclBase {
46
override string toString() { result = this.getName() }
7+
8+
TypeDecl getBaseTypeDecl(int i) { result = this.getBaseType(i).(AnyGenericType).getDeclaration() }
9+
10+
TypeDecl getABaseTypeDecl() { result = this.getBaseTypeDecl(_) }
11+
12+
TypeDecl getDerivedTypeDecl(int i) { result.getBaseTypeDecl(i) = this }
13+
14+
TypeDecl getADerivedTypeDecl() { result = this.getDerivedTypeDecl(_) }
515
}

0 commit comments

Comments
 (0)