Skip to content

Commit e82c21d

Browse files
committed
Don't include desugared nodes in the printed AST
The base `PrintAstConfiguration` class already has a predicate for filtering out desugared nodes - this change just makes use of it in the query. This fixes https://github.com/github/codeql-team/issues/408, which was caused by including nodes representing the desugaring of a[b] = c in the query output. This would result in multiple edges to the same target node (one from the surface AST and another from the desugared AST), which the VSCode AST viewer cannot handle.
1 parent df4fb23 commit e82c21d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ql/src/ide-contextual-queries/printAst.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ external string selectedSourceFile();
2121
*/
2222
class Cfg extends PrintAstConfiguration {
2323
override predicate shouldPrintNode(AstNode n) {
24+
super.shouldPrintNode(n) and
2425
n.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile())
2526
}
2627
}

0 commit comments

Comments
 (0)