File tree Expand file tree Collapse file tree 2 files changed +4
-14
lines changed
python/ql/lib/semmle/python/regexp/internal Expand file tree Collapse file tree 2 files changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -110,13 +110,10 @@ private module FindRegexMode {
110
110
deprecated class Regex = RegExp ;
111
111
112
112
/** A StrConst used as a regular expression */
113
- class RegExp extends Expr {
113
+ class RegExp extends Expr instanceof StrConst {
114
114
DataFlow:: Node use ;
115
115
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 ( ) }
120
117
121
118
/** Gets a data-flow node where this string value is used as a regular expression. */
122
119
DataFlow:: Node getAUse ( ) { result = use }
@@ -332,11 +329,7 @@ class RegExp extends Expr {
332
329
}
333
330
334
331
/** 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 ( ) }
340
333
341
334
/** Gets the `i`th character of this regex */
342
335
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
15
15
private import semmle.python.Concepts as Concepts
16
16
17
17
/** 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 }
22
19
23
20
private import semmle.python.regex as Regex
24
21
You can’t perform that action at this time.
0 commit comments