Skip to content

Commit 504c34e

Browse files
committed
use shouldPrint to filter out regular expressions from other files
1 parent d6f9e37 commit 504c34e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

javascript/ql/src/semmle/javascript/PrintAst.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ private newtype TPrintAstNode =
7474
THTMLAttributeNode(HTML::Attribute attr) { shouldPrint(attr, _) and not isNotNeeded(attr) } or
7575
THTMLScript(Script script) { shouldPrint(script, _) and not isNotNeeded(script) } or
7676
THTMLCodeInAttr(CodeInAttribute attr) { shouldPrint(attr, _) and not isNotNeeded(attr) } or
77-
TRegExpTermNode(RegExpTerm term) { term.isUsedAsRegExp() }
77+
TRegExpTermNode(RegExpTerm term) {
78+
shouldPrint(term, _) and
79+
term.isUsedAsRegExp() and
80+
any(RegExpLiteral lit).getRoot() = term.getRootTerm()
81+
}
7882

7983
/**
8084
* A node in the output tree.

0 commit comments

Comments
 (0)