File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
swift/ql/lib/codeql/swift/controlflow/internal Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -28,11 +28,19 @@ class Scope extends AstNode instanceof Scope::Range {
28
28
29
29
cached
30
30
private module Cached {
31
- private AstNode getParentOfAstStep ( Element e ) {
31
+ /**
32
+ * Gets the immediate parent of a non-`AstNode` element `e`.
33
+ *
34
+ * We restrict `e` to be a non-`AstNode` to skip past non-`AstNode` in
35
+ * the transitive closure computation in `getParentOfAst`. This is
36
+ * necessary because the parent of an `AstNode` is not necessarily an `AstNode`.
37
+ */
38
+ private Element getParentOfAstStep ( Element e ) {
32
39
not e instanceof AstNode and
33
40
result = getImmediateParent ( e )
34
41
}
35
42
43
+ /** Gets the nearest enclosing parent of `ast` that is an `AstNode`. */
36
44
cached
37
45
AstNode getParentOfAst ( AstNode ast ) { result = getParentOfAstStep * ( getImmediateParent ( ast ) ) }
38
46
}
You can’t perform that action at this time.
0 commit comments