Skip to content

Commit 68bdd51

Browse files
committed
Swift: Add QLDoc encouraging this pattern.
1 parent 0d8aa82 commit 68bdd51

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

swift/ql/lib/codeql/swift/elements/AstNode.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class AstNode extends Generated::AstNode {
5757

5858
/**
5959
* Gets the nearest declaration that contains this AST node, if any.
60+
*
61+
* Note that the nearest declaration may be an extension of a type declaration. If you always
62+
* want the type declaration and not the extension, use `getEnclosingDecl().asNominalTypeDecl()`.
6063
*/
6164
final Decl getEnclosingDecl() { result = Cached::getEnclosingDecl(this) }
6265

0 commit comments

Comments
 (0)