Hide disconnected tokens

This commit is contained in:
Arthur Baars
2020-11-04 12:25:14 +01:00
parent 96423d2e8e
commit 8056186c3c

View File

@@ -39,7 +39,14 @@ class PrintAstNode extends AstNode {
* are printed, but the query can override
* `PrintAstConfiguration.shouldPrintNode` to filter the output.
*/
predicate shouldPrint() { shouldPrintNode(this) }
predicate shouldPrint() {
(
not this instanceof Token
or
exists(AstNode parent | parent.getAFieldOrChild() = this)
) and
shouldPrintNode(this)
}
}
private predicate shouldPrintNode(AstNode n) {