Swift: Add convenience member predicates to 'TypeDecl'.

This commit is contained in:
Mathias Vorreiter Pedersen
2022-09-01 09:28:37 +01:00
parent 74cd532adc
commit e294b8f74a

View File

@@ -1,5 +1,15 @@
private import codeql.swift.generated.decl.TypeDecl
private import codeql.swift.generated.type.Type
private import codeql.swift.elements.type.AnyGenericType
class TypeDecl extends TypeDeclBase {
override string toString() { result = this.getName() }
TypeDecl getBaseTypeDecl(int i) { result = this.getBaseType(i).(AnyGenericType).getDeclaration() }
TypeDecl getABaseTypeDecl() { result = this.getBaseTypeDecl(_) }
TypeDecl getDerivedTypeDecl(int i) { result.getBaseTypeDecl(i) = this }
TypeDecl getADerivedTypeDecl() { result = this.getDerivedTypeDecl(_) }
}