11/**
2- * Provides classes used to pretty-print a Swift AST as a graph.
2+ * Provides classes used to pretty-print a Rust AST as a graph.
33 * This is factored out of `PrintAst.qll` for testing purposes.
44 */
55
@@ -20,7 +20,7 @@ class PrintAstConfiguration extends TPrintAstConfiguration {
2020 /**
2121 * Holds if the AST for `e` should be printed. By default, holds for all.
2222 */
23- predicate shouldPrint ( Locatable e ) { not e instanceof Diagnostics and not e instanceof MacroRole }
23+ predicate shouldPrint ( Locatable e ) { any ( ) }
2424}
2525
2626private predicate shouldPrint ( Locatable e ) { any ( PrintAstConfiguration config ) .shouldPrint ( e ) }
@@ -88,21 +88,7 @@ class PrintLocatable extends PrintAstNode, TPrintLocatable {
8888 final override predicate shouldBePrinted ( ) { shouldPrint ( ast ) }
8989
9090 override predicate hasChild ( PrintAstNode child , int index , string label ) {
91- exists ( Locatable c , int i , string accessor |
92- c = getChildAndAccessor ( ast , i , accessor ) and
93- (
94- // use even indexes for normal children, leaving odd slots for conversions if any
95- child = TPrintLocatable ( c ) and index = 2 * i and label = accessor
96- or
97- child = TPrintLocatable ( c .getFullyUnresolved ( ) .( Unresolved ) ) and
98- index = 2 * i + 1 and
99- (
100- if c instanceof Expr
101- then label = accessor + ".getFullyConverted()"
102- else label = accessor + ".getFullyUnresolved()"
103- )
104- )
105- )
91+ child = TPrintLocatable ( any ( Locatable c | c = getChildAndAccessor ( ast , index , label ) ) )
10692 }
10793
10894 final override Locatable getAstNode ( ) { result = ast }
@@ -122,8 +108,3 @@ class PrintUnresolved extends PrintLocatable {
122108 child = TPrintLocatable ( getImmediateChildAndAccessor ( ast , index , label ) .( Unresolved ) )
123109 }
124110}
125-
126- private predicate hasPropertyWrapperElement ( VarDecl d , Locatable a ) {
127- a = [ d .getPropertyWrapperBackingVar ( ) , d .getPropertyWrapperProjectionVar ( ) ] or
128- a = [ d .getPropertyWrapperBackingVarBinding ( ) , d .getPropertyWrapperProjectionVarBinding ( ) ]
129- }
0 commit comments