Swift: Add QLDoc encouraging this pattern.

This commit is contained in:
Geoffrey White
2023-05-19 14:27:33 +01:00
parent 0d8aa825d9
commit 68bdd51dd3

View File

@@ -57,6 +57,9 @@ class AstNode extends Generated::AstNode {
/**
* Gets the nearest declaration that contains this AST node, if any.
*
* Note that the nearest declaration may be an extension of a type declaration. If you always
* want the type declaration and not the extension, use `getEnclosingDecl().asNominalTypeDecl()`.
*/
final Decl getEnclosingDecl() { result = Cached::getEnclosingDecl(this) }