From 8056186c3cafb3a8b306cc65287d8226ddab0fc3 Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Wed, 4 Nov 2020 12:25:14 +0100 Subject: [PATCH] Hide disconnected tokens --- ql/src/codeql_ruby/printAst.qll | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) {