diff --git a/ql/src/codeql_ruby/printAst.qll b/ql/src/codeql_ruby/printAst.qll index 6d7516ab812..c0ff8049570 100644 --- a/ql/src/codeql_ruby/printAst.qll +++ b/ql/src/codeql_ruby/printAst.qll @@ -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) {