File tree Expand file tree Collapse file tree 3 files changed +795
-27
lines changed
src/queries/ide-contextual-queries Expand file tree Collapse file tree 3 files changed +795
-27
lines changed Original file line number Diff line number Diff line change 1010import swift
1111import codeql.swift.printast.PrintAst
1212import IDEContextual
13+ import codeql.swift.generated.ParentChild
1314
1415/**
1516 * Gets the source file to generate an AST from.
@@ -23,6 +24,10 @@ class PrintAstConfigurationOverride extends PrintAstConfiguration {
2324 */
2425 override predicate shouldPrint ( Locatable e ) {
2526 super .shouldPrint ( e ) and
26- e .getFile ( ) = getFileBySourceArchiveName ( selectedSourceFile ( ) )
27+ (
28+ e .getFile ( ) = getFileBySourceArchiveName ( selectedSourceFile ( ) )
29+ or
30+ exists ( Locatable parent | this .shouldPrint ( parent ) and parent = getImmediateParent ( e ) )
31+ )
2732 }
2833}
Original file line number Diff line number Diff line change 11private import codeql.swift.elements
2+ private import codeql.swift.generated.ParentChild
23
34cached
45predicate toBeTested ( Element e ) {
56 e instanceof File
67 or
7- e instanceof AppliedPropertyWrapperExpr
8- or
98 exists ( ModuleDecl m |
109 m = e and
1110 not m .isBuiltinModule ( ) and
@@ -32,6 +31,8 @@ predicate toBeTested(Element e) {
3231 e .( UnspecifiedElement ) .getParent ( ) = tested
3332 or
3433 e .( OpaqueTypeDecl ) .getNamingDeclaration ( ) = tested
34+ or
35+ tested = getImmediateParent ( e )
3536 )
3637 )
3738}
You can’t perform that action at this time.
0 commit comments