File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
swift/ql/lib/codeql/swift/elements Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
- // generated by codegen/codegen.py, remove this comment if you wish to edit this file
2
1
private import codeql.swift.generated.AstNode
2
+ private import codeql.swift.elements.decl.AbstractFunctionDecl
3
+ private import codeql.swift.generated.GetImmediateParent
3
4
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
+ }
You can’t perform that action at this time.
0 commit comments