Skip to content

Commit 3549830

Browse files
committed
Swift: this.(PotentialRegexEval) -> super. or this. .
1 parent 8a5f3e4 commit 3549830

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

swift/ql/lib/codeql/swift/regex/Regex.qll

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ private class NSStringRegexAdditionalFlowStep extends RegexAdditionalFlowStep {
300300
* ```
301301
*/
302302
class RegexEval extends CallExpr instanceof PotentialRegexEval {
303-
RegexEval() { this.(PotentialRegexEval).doesEvaluate() }
303+
RegexEval() { this.doesEvaluate() }
304304

305305
/**
306306
* Gets the input to this call that is the regular expression being evaluated.
@@ -309,31 +309,30 @@ class RegexEval extends CallExpr instanceof PotentialRegexEval {
309309
* Consider using `getARegex()` instead (which tracks the regular expression
310310
* input back to its source).
311311
*/
312-
Expr getRegexInput() { result = this.(PotentialRegexEval).getRegexInput().asExpr() }
312+
Expr getRegexInput() { result = super.getRegexInput().asExpr() }
313313

314314
/**
315315
* Gets the input to this call that is the string the regular expression is evaluated on.
316316
*/
317-
Expr getStringInput() { result = this.(PotentialRegexEval).getStringInput().asExpr() }
317+
Expr getStringInput() { result = super.getStringInput().asExpr() }
318318

319319
/**
320320
* Gets a dataflow node for an options input that might contain parse mode
321321
* flags (if any).
322322
*/
323-
DataFlow::Node getAnOptionsInput() { result = this.(PotentialRegexEval).getAnOptionsInput() }
323+
DataFlow::Node getAnOptionsInput() { result = super.getAnOptionsInput() }
324324

325325
/**
326326
* Gets a regular expression value that is evaluated here (if any can be identified).
327327
*/
328328
RegExp getARegex() {
329329
// string literal used directly as a regex
330-
DataFlow::exprNode(result).(ParsedStringRegex).getAParse() =
331-
this.(PotentialRegexEval).getRegexInput()
330+
DataFlow::exprNode(result).(ParsedStringRegex).getAParse() = super.getRegexInput()
332331
or
333332
// string literal -> regex object -> use
334333
exists(RegexCreation regexCreation |
335334
DataFlow::exprNode(result).(ParsedStringRegex).getAParse() = regexCreation.getStringInput() and
336-
RegexUseFlow::flow(regexCreation, this.(PotentialRegexEval).getRegexInput())
335+
RegexUseFlow::flow(regexCreation, super.getRegexInput())
337336
)
338337
}
339338

@@ -347,8 +346,8 @@ class RegexEval extends CallExpr instanceof PotentialRegexEval {
347346
any(RegexAdditionalFlowStep s).setsParseMode(setNode, result, true) and
348347
// reaches this eval
349348
(
350-
RegexParseModeFlow::flow(setNode, this.(PotentialRegexEval).getRegexInput()) or
351-
RegexParseModeFlow::flow(setNode, this.(PotentialRegexEval).getAnOptionsInput())
349+
RegexParseModeFlow::flow(setNode, super.getRegexInput()) or
350+
RegexParseModeFlow::flow(setNode, super.getAnOptionsInput())
352351
)
353352
)
354353
}

0 commit comments

Comments
 (0)