@@ -74,10 +74,12 @@ module Make<RegexTreeViewSig TreeImpl> {
7474 forex ( RegExpTerm child | child = t .( RegExpSequence ) .getAChild ( ) | matchesEpsilon ( child ) )
7575 }
7676
77+ final private class FinalRegExpSubPattern = RegExpSubPattern ;
78+
7779 /**
7880 * A lookahead/lookbehind that matches the empty string.
7981 */
80- class EmptyPositiveSubPattern instanceof RegExpSubPattern {
82+ class EmptyPositiveSubPattern extends FinalRegExpSubPattern {
8183 EmptyPositiveSubPattern ( ) {
8284 (
8385 this instanceof RegExpPositiveLookahead
@@ -86,19 +88,18 @@ module Make<RegexTreeViewSig TreeImpl> {
8688 ) and
8789 matchesEpsilon ( this .getOperand ( ) )
8890 }
89-
90- /** Gets a string representation of this sub-pattern. */
91- string toString ( ) { result = super .toString ( ) }
9291 }
9392
9493 /** DEPRECATED: Use `EmptyPositiveSubPattern` instead. */
9594 deprecated class EmptyPositiveSubPatttern = EmptyPositiveSubPattern ;
9695
96+ final private class FinalRegExpTerm = RegExpTerm ;
97+
9798 /**
9899 * A branch in a disjunction that is the root node in a literal, or a literal
99100 * whose root node is not a disjunction.
100101 */
101- class RegExpRoot instanceof RegExpTerm {
102+ class RegExpRoot extends FinalRegExpTerm {
102103 RegExpRoot ( ) {
103104 exists ( RegExpParent parent |
104105 exists ( RegExpAlt alt |
@@ -122,12 +123,6 @@ module Make<RegexTreeViewSig TreeImpl> {
122123 // not excluded for library specific reasons
123124 not isExcluded ( super .getRootTerm ( ) .getParent ( ) )
124125 }
125-
126- /** Gets a string representation of this root term. */
127- string toString ( ) { result = this .( RegExpTerm ) .toString ( ) }
128-
129- /** Gets the outermost term of this regular expression. */
130- RegExpTerm getRootTerm ( ) { result = super .getRootTerm ( ) }
131126 }
132127
133128 /**
@@ -146,17 +141,8 @@ module Make<RegexTreeViewSig TreeImpl> {
146141 /**
147142 * A regexp term that is relevant for this ReDoS analysis.
148143 */
149- class RelevantRegExpTerm instanceof RegExpTerm {
144+ class RelevantRegExpTerm extends FinalRegExpTerm {
150145 RelevantRegExpTerm ( ) { getRoot ( this ) .isRelevant ( ) }
151-
152- /** Gets a string representation of this term. */
153- string toString ( ) { result = super .toString ( ) }
154-
155- /** Gets the raw source text of this term. */
156- string getRawValue ( ) { result = super .getRawValue ( ) }
157-
158- /** Gets the outermost term of this regular expression. */
159- RegExpTerm getRootTerm ( ) { result = super .getRootTerm ( ) }
160146 }
161147
162148 /**
@@ -864,7 +850,7 @@ module Make<RegexTreeViewSig TreeImpl> {
864850 * which represents the state of the NFA before starting to
865851 * match `t`, or the `i`th character in `t` if `t` is a constant.
866852 */
867- class State extends TState {
853+ final class State extends TState {
868854 RegExpTerm repr ;
869855
870856 State ( ) {
@@ -1056,16 +1042,10 @@ module Make<RegexTreeViewSig TreeImpl> {
10561042 }
10571043
10581044 /** A state within a regular expression that contains a candidate state. */
1059- class RelevantState instanceof State {
1045+ class RelevantState extends State {
10601046 RelevantState ( ) {
10611047 exists ( State s | isCandidate ( s ) | getRoot ( s .getRepr ( ) ) = getRoot ( this .getRepr ( ) ) )
10621048 }
1063-
1064- /** Gets a string representation for this state in a regular expression. */
1065- string toString ( ) { result = State .super .toString ( ) }
1066-
1067- /** Gets the term represented by this state. */
1068- RegExpTerm getRepr ( ) { result = State .super .getRepr ( ) }
10691049 }
10701050 }
10711051
0 commit comments