mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
JS: Added in RegExpCreationNode maybeGlobal predicate for more convenience.
This commit is contained in:
@@ -121,9 +121,7 @@ class StringReplaceCall extends DataFlow::MethodCallNode {
|
||||
* Holds if this is a global replacement, that is, the first argument is a regular expression
|
||||
* with the `g` flag or unknown flags, or this is a call to `.replaceAll()`.
|
||||
*/
|
||||
predicate maybeGlobal() {
|
||||
RegExp::maybeGlobal(this.getRegExp().tryGetFlags()) or this.getMethodName() = "replaceAll"
|
||||
}
|
||||
predicate maybeGlobal() { this.getRegExp().maybeGlobal() or this.getMethodName() = "replaceAll" }
|
||||
|
||||
/**
|
||||
* Holds if this call to `replace` replaces `old` with `new`.
|
||||
|
||||
@@ -1685,6 +1685,9 @@ class RegExpCreationNode extends DataFlow::SourceNode {
|
||||
/** Holds if the constructed predicate has the `g` flag. */
|
||||
predicate isGlobal() { RegExp::isGlobal(this.getFlags()) }
|
||||
|
||||
/** Holds if the constructed predicate has the `g` flag or unknown flags. */
|
||||
predicate maybeGlobal() { RegExp::maybeGlobal(this.tryGetFlags()) }
|
||||
|
||||
/** Gets a data flow node referring to this regular expression. */
|
||||
private DataFlow::SourceNode getAReference(DataFlow::TypeTracker t) {
|
||||
t.start() and
|
||||
|
||||
Reference in New Issue
Block a user