@@ -8,28 +8,24 @@ module StringOps {
88 /**
99 * A expression that is equivalent to `A.startsWith(B)` or `!A.startsWith(B)`.
1010 */
11- class StartsWith extends DataFlow:: Node {
12- StartsWith:: Range range ;
13-
14- StartsWith ( ) { range = this }
15-
11+ class StartsWith extends DataFlow:: Node instanceof StartsWith:: Range {
1612 /**
1713 * Gets the `A` in `A.startsWith(B)`.
1814 */
19- DataFlow:: Node getBaseString ( ) { result = range .getBaseString ( ) }
15+ DataFlow:: Node getBaseString ( ) { result = super .getBaseString ( ) }
2016
2117 /**
2218 * Gets the `B` in `A.startsWith(B)`.
2319 */
24- DataFlow:: Node getSubstring ( ) { result = range .getSubstring ( ) }
20+ DataFlow:: Node getSubstring ( ) { result = super .getSubstring ( ) }
2521
2622 /**
2723 * Gets the polarity of the check.
2824 *
2925 * If the polarity is `false` the check returns `true` if the string does not start
3026 * with the given substring.
3127 */
32- boolean getPolarity ( ) { result = range .getPolarity ( ) }
28+ boolean getPolarity ( ) { result = super .getPolarity ( ) }
3329 }
3430
3531 module StartsWith {
@@ -237,28 +233,24 @@ module StringOps {
237233 /**
238234 * An expression that is equivalent to `A.endsWith(B)` or `!A.endsWith(B)`.
239235 */
240- class EndsWith extends DataFlow:: Node {
241- EndsWith:: Range range ;
242-
243- EndsWith ( ) { this = range }
244-
236+ class EndsWith extends DataFlow:: Node instanceof EndsWith:: Range {
245237 /**
246238 * Gets the `A` in `A.startsWith(B)`.
247239 */
248- DataFlow:: Node getBaseString ( ) { result = range .getBaseString ( ) }
240+ DataFlow:: Node getBaseString ( ) { result = super .getBaseString ( ) }
249241
250242 /**
251243 * Gets the `B` in `A.startsWith(B)`.
252244 */
253- DataFlow:: Node getSubstring ( ) { result = range .getSubstring ( ) }
245+ DataFlow:: Node getSubstring ( ) { result = super .getSubstring ( ) }
254246
255247 /**
256248 * Gets the polarity if the check.
257249 *
258250 * If the polarity is `false` the check returns `true` if the string does not end
259251 * with the given substring.
260252 */
261- boolean getPolarity ( ) { result = range .getPolarity ( ) }
253+ boolean getPolarity ( ) { result = super .getPolarity ( ) }
262254 }
263255
264256 module EndsWith {
@@ -662,39 +654,35 @@ module StringOps {
662654 * if (!match) { ... } // <--- 'match' is the RegExpTest
663655 * ```
664656 */
665- class RegExpTest extends DataFlow:: Node {
666- RegExpTest:: Range range ;
667-
668- RegExpTest ( ) { this = range }
669-
657+ class RegExpTest extends DataFlow:: Node instanceof RegExpTest:: Range {
670658 /**
671659 * Gets the AST of the regular expression used in the test, if it can be seen locally.
672660 */
673661 RegExpTerm getRegExp ( ) {
674662 result = getRegExpOperand ( ) .getALocalSource ( ) .( DataFlow:: RegExpCreationNode ) .getRoot ( )
675663 or
676- result = range .getRegExpOperand ( true ) .asExpr ( ) .( StringLiteral ) .asRegExp ( )
664+ result = super .getRegExpOperand ( true ) .asExpr ( ) .( StringLiteral ) .asRegExp ( )
677665 }
678666
679667 /**
680668 * Gets the data flow node corresponding to the regular expression object used in the test.
681669 *
682670 * In some cases this represents a string value being coerced to a RegExp object.
683671 */
684- DataFlow:: Node getRegExpOperand ( ) { result = range .getRegExpOperand ( _) }
672+ DataFlow:: Node getRegExpOperand ( ) { result = super .getRegExpOperand ( _) }
685673
686674 /**
687675 * Gets the data flow node corresponding to the string being tested against the regular expression.
688676 */
689- DataFlow:: Node getStringOperand ( ) { result = range .getStringOperand ( ) }
677+ DataFlow:: Node getStringOperand ( ) { result = super .getStringOperand ( ) }
690678
691679 /**
692680 * Gets the return value indicating that the string matched the regular expression.
693681 *
694682 * For example, for `regexp.exec(str) == null`, the polarity is `false`, and for
695683 * `regexp.exec(str) != null` the polarity is `true`.
696684 */
697- boolean getPolarity ( ) { result = range .getPolarity ( ) }
685+ boolean getPolarity ( ) { result = super .getPolarity ( ) }
698686 }
699687
700688 /**
0 commit comments