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 {
2828
2929cached
3030private 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 ) {
3239 not e instanceof AstNode and
3340 result = getImmediateParent ( e )
3441 }
3542
43+ /** Gets the nearest enclosing parent of `ast` that is an `AstNode`. */
3644 cached
3745 AstNode getParentOfAst ( AstNode ast ) { result = getParentOfAstStep * ( getImmediateParent ( ast ) ) }
3846}
You can’t perform that action at this time.
0 commit comments