Skip to content

Commit b7e0d1f

Browse files
committed
don't include mock Ast nodes in PrintAst.ql
1 parent 51d5e88 commit b7e0d1f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

ql/ql/src/codeql_ql/printAstAst.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import ast.Ast
1212
private import codeql.Locations
13+
import ast.internal.AstNodes
1314

1415
/**
1516
* The query can extend this class to control which nodes are printed.
@@ -20,7 +21,7 @@ class PrintAstConfiguration extends string {
2021
/**
2122
* Holds if the given node should be printed.
2223
*/
23-
predicate shouldPrintNode(AstNode n) { any() }
24+
predicate shouldPrintNode(AstNode n) { not exists(toMock(n)) }
2425
}
2526

2627
/**

ql/ql/test/printAst/printAst.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ nodes
161161
| Foo.qll:30:10:30:27 | assume_small_delta | semmle.order | 80 |
162162
| Foo.qll:31:3:31:14 | NewTypeBranch TPathNodeMid | semmle.label | [NewTypeBranch] NewTypeBranch TPathNodeMid |
163163
| Foo.qll:31:3:31:14 | NewTypeBranch TPathNodeMid | semmle.order | 81 |
164-
| file://:0:0:0:0 | Module EquivalenceRelation | semmle.label | [Module] Module EquivalenceRelation |
165-
| file://:0:0:0:0 | Module QlBuiltins | semmle.label | [Module] Module QlBuiltins |
166164
| file://:0:0:0:0 | abs | semmle.label | [BuiltinPredicate] abs |
167165
| file://:0:0:0:0 | abs | semmle.label | [BuiltinPredicate] abs |
168166
| file://:0:0:0:0 | acos | semmle.label | [BuiltinPredicate] acos |
@@ -411,7 +409,6 @@ edges
411409
| Foo.qll:30:3:30:28 | annotation | Foo.qll:30:10:30:27 | assume_small_delta | semmle.order | 80 |
412410
| Foo.qll:31:3:31:14 | NewTypeBranch TPathNodeMid | Foo.qll:30:3:30:28 | annotation | semmle.label | getAnAnnotation() |
413411
| Foo.qll:31:3:31:14 | NewTypeBranch TPathNodeMid | Foo.qll:30:3:30:28 | annotation | semmle.order | 79 |
414-
| file://:0:0:0:0 | Module QlBuiltins | file://:0:0:0:0 | Module EquivalenceRelation | semmle.label | getAMember() |
415412
| printAst.ql:1:1:1:28 | Import | printAst.ql:1:18:1:28 | printAstAst | semmle.label | getModuleExpr() |
416413
| printAst.ql:1:1:1:28 | Import | printAst.ql:1:18:1:28 | printAstAst | semmle.order | 84 |
417414
| printAst.ql:1:1:1:29 | TopLevel | printAst.ql:1:1:1:28 | Import | semmle.label | getAnImport() |

0 commit comments

Comments
 (0)