File tree Expand file tree Collapse file tree
python/ql/lib/semmle/python/regexp/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,13 +110,10 @@ private module FindRegexMode {
110110deprecated class Regex = RegExp ;
111111
112112/** A StrConst used as a regular expression */
113- class RegExp extends Expr {
113+ class RegExp extends Expr instanceof StrConst {
114114 DataFlow:: Node use ;
115115
116- RegExp ( ) {
117- ( this instanceof Bytes or this instanceof Unicode ) and
118- this = RegExpTracking:: regExpSource ( use ) .asExpr ( )
119- }
116+ RegExp ( ) { this = RegExpTracking:: regExpSource ( use ) .asExpr ( ) }
120117
121118 /** Gets a data-flow node where this string value is used as a regular expression. */
122119 DataFlow:: Node getAUse ( ) { result = use }
@@ -332,11 +329,7 @@ class RegExp extends Expr {
332329 }
333330
334331 /** Gets the text of this regex */
335- string getText ( ) {
336- result = this .( Unicode ) .getS ( )
337- or
338- result = this .( Bytes ) .getS ( )
339- }
332+ string getText ( ) { result = super .getText ( ) }
340333
341334 /** Gets the `i`th character of this regex */
342335 string getChar ( int i ) { result = this .getText ( ) .charAt ( i ) }
Original file line number Diff line number Diff line change @@ -15,10 +15,7 @@ private import semmle.python.dataflow.new.DataFlow
1515private import semmle.python.Concepts as Concepts
1616
1717/** Gets a constant string value that may be used as a regular expression. */
18- DataFlow:: LocalSourceNode strStart ( ) {
19- result .asExpr ( ) instanceof Bytes or
20- result .asExpr ( ) instanceof Unicode
21- }
18+ DataFlow:: Node strStart ( ) { result .asExpr ( ) instanceof StrConst }
2219
2320private import semmle.python.regex as Regex
2421
You can’t perform that action at this time.
0 commit comments