Merge pull request #10254 from MathiasVP/swift-base-and-derived-on-decls

Swift: Add `getBaseTypeDecl` to `TypeDecl`
This commit is contained in:
Geoffrey White
2022-09-01 10:35:29 +01:00
committed by GitHub

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(_) }
}