Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3ae6080 + cde2880 commit 84518c8Copy full SHA for 84518c8
1 file changed
swift/ql/lib/codeql/swift/elements/AstNode.qll
@@ -1,4 +1,17 @@
1
-// generated by codegen/codegen.py, remove this comment if you wish to edit this file
2
private import codeql.swift.generated.AstNode
+private import codeql.swift.elements.decl.AbstractFunctionDecl
3
+private import codeql.swift.generated.GetImmediateParent
4
-class AstNode extends AstNodeBase { }
5
+private Element getEnclosingFunctionStep(Element e) {
6
+ not e instanceof AbstractFunctionDecl and
7
+ result = getImmediateParent(e)
8
+}
9
+
10
+cached
11
+private AbstractFunctionDecl getEnclosingFunctionCached(AstNode ast) {
12
+ result = getEnclosingFunctionStep*(getImmediateParent(ast))
13
14
15
+class AstNode extends AstNodeBase {
16
+ final AbstractFunctionDecl getEnclosingFunction() { result = getEnclosingFunctionCached(this) }
17
0 commit comments