Skip to content

Commit 62125fa

Browse files
committed
Swift: Explanatory comments.
1 parent 2875d86 commit 62125fa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

swift/ql/lib/codeql/swift/dataflow/ExternalFlow.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,16 +431,19 @@ private Element interpretElement0(
431431
matchesSignature(method, signature) and
432432
result = method
433433
|
434+
// member declared in the named type or a subtype of it (or an extension of any)
434435
subtypes = true and
435436
declWithMethod.getNominalTypeDecl() = namedTypeDecl.getADerivedTypeDecl*()
436437
or
438+
// member declared in a type that's extended with a protocol that is the named type
437439
exists(ExtensionDecl e |
438440
e.getExtendedTypeDecl().getADerivedTypeDecl*() = declWithMethod.getNominalTypeDecl()
439441
|
440442
subtypes = true and
441443
e.getAProtocol() = namedTypeDecl.getADerivedTypeDecl*()
442444
)
443445
or
446+
// member declared directly in the named type (or an extension of it)
444447
subtypes = false and
445448
declWithMethod.getNominalTypeDecl() = namedTypeDecl
446449
)
@@ -453,16 +456,19 @@ private Element interpretElement0(
453456
namedTypeDecl.getFullName() = type and
454457
result = field
455458
|
459+
// field declared in the named type or a subtype of it (or an extension of any)
456460
subtypes = true and
457461
declWithField.getNominalTypeDecl() = namedTypeDecl.getADerivedTypeDecl*()
458462
or
463+
// field declared in a type that's extended with a protocol that is the named type
459464
exists(ExtensionDecl e |
460465
e.getExtendedTypeDecl().getADerivedTypeDecl*() = declWithField.getNominalTypeDecl()
461466
|
462467
subtypes = true and
463468
e.getAProtocol() = namedTypeDecl.getADerivedTypeDecl*()
464469
)
465470
or
471+
// field declared directly in the named type (or an extension of it)
466472
subtypes = false and
467473
declWithField.getNominalTypeDecl() = namedTypeDecl
468474
)

0 commit comments

Comments
 (0)