Skip to content

Commit e9b496b

Browse files
authored
Merge pull request #7831 from RasmusWL/printast-remove-regexp
Python: Remove `RegExpTerm` from PrintAST
2 parents 2e2913b + 8386b36 commit e9b496b

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
lines changed

python/ql/lib/semmle/python/PrintAst.qll

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ private newtype TPrintAstNode =
5353
shouldPrint(list.getAnItem(), _) and
5454
not list = any(Module mod).getBody() and
5555
not forall(AstNode child | child = list.getAnItem() | isNotNeeded(child))
56-
} or
57-
TRegExpTermNode(RegExpTerm term) {
58-
exists(StrConst str | term.getRootTerm() = getParsedRegExp(str) and shouldPrint(str, _))
5956
}
6057

6158
/**
@@ -430,32 +427,6 @@ class ParameterNode extends AstElementNode {
430427
*/
431428
class StrConstNode extends AstElementNode {
432429
override StrConst element;
433-
434-
override PrintAstNode getChild(int childIndex) {
435-
childIndex = 0 and result.(RegExpTermNode).getTerm() = getParsedRegExp(element)
436-
}
437-
}
438-
439-
/**
440-
* A print node for a regular expression term.
441-
*/
442-
class RegExpTermNode extends TRegExpTermNode, PrintAstNode {
443-
RegExpTerm term;
444-
445-
RegExpTermNode() { this = TRegExpTermNode(term) }
446-
447-
/** Gets the `RegExpTerm` for this node. */
448-
RegExpTerm getTerm() { result = term }
449-
450-
override PrintAstNode getChild(int childIndex) {
451-
result.(RegExpTermNode).getTerm() = term.getChild(childIndex)
452-
}
453-
454-
override string toString() {
455-
result = "[" + strictconcat(term.getPrimaryQLClass(), " | ") + "] " + term.toString()
456-
}
457-
458-
override Location getLocation() { result = term.getLocation() }
459430
}
460431

461432
/**
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: fix
3+
---
4+
* The [View AST functionality](https://codeql.github.com/docs/codeql-for-visual-studio-code/exploring-the-structure-of-your-source-code/) no longer prints detailed information about regular expressions, greatly improving performance.

0 commit comments

Comments
 (0)