Skip to content

Commit 91c324e

Browse files
committed
Swift: Fix for getFullName.
1 parent 29f7862 commit 91c324e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

swift/ql/lib/codeql/swift/elements/decl/TypeDecl.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ class TypeDecl extends Generated::TypeDecl {
2828
cached
2929
string getFullName() {
3030
not this.getEnclosingDecl() instanceof TypeDecl and
31+
not this.getEnclosingDecl() instanceof ExtensionDecl and
3132
result = this.getName()
3233
or
3334
result = this.getEnclosingDecl().(TypeDecl).getFullName() + "." + this.getName()
35+
or
36+
result = this.getEnclosingDecl().(ExtensionDecl).getExtendedTypeDecl().getFullName() + "." + this.getName()
3437
}
3538
}

swift/ql/test/library-tests/elements/decl/abstractfunctiondecl/abstractfunctiondecl.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
| abstractfunctiondecl.swift:21:2:21:16 | func5() | MethodDecl, getName:func5(), hasName:func5(), hasQualifiedName(2):Class3.func5(), hasQualifiedName(3):abstractfunctiondecl.Class3.func5(), memberOf:Class3 |
77
| abstractfunctiondecl.swift:25:2:25:16 | func6() | MethodDecl, getName:func6(), hasName:func6(), hasQualifiedName(2):Struct1.func6(), hasQualifiedName(3):abstractfunctiondecl.Struct1.func6(), memberOf:Struct1 |
88
| abstractfunctiondecl.swift:31:2:31:16 | func7() | MethodDecl, getName:func7(), hasName:func7(), hasQualifiedName(2):Enum1.func7(), hasQualifiedName(3):abstractfunctiondecl.Enum1.func7(), memberOf:Enum1 |
9-
| abstractfunctiondecl.swift:37:3:37:17 | func8() | MethodDecl, getName:func8(), hasName:func8(), hasQualifiedName(2):Class4.func8(), hasQualifiedName(3):abstractfunctiondecl.Class4.func8(), memberOf:Class4 |
9+
| abstractfunctiondecl.swift:37:3:37:17 | func8() | MethodDecl, getName:func8(), hasName:func8(), hasQualifiedName(2):Class1.Class4.func8(), hasQualifiedName(3):abstractfunctiondecl.Class1.Class4.func8(), memberOf:Class1.Class4 |

0 commit comments

Comments
 (0)