mirror of
https://github.com/github/codeql.git
synced 2026-02-19 08:23:45 +01:00
Hide disconnected tokens
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user