Skip to content

Commit e314fef

Browse files
committed
JS: In oprder to keep code more consistent removed predicate isGlobal from RegExpCreationNode and reused RegExp::isGlobal in std
1 parent d6372ae commit e314fef

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

javascript/ql/lib/semmle/javascript/StandardLibrary.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class StringReplaceCall extends DataFlow::MethodCallNode {
115115
* Holds if this is a global replacement, that is, the first argument is a regular expression
116116
* with the `g` flag, or this is a call to `.replaceAll()`.
117117
*/
118-
predicate isGlobal() { this.getRegExp().isGlobal() or this.getMethodName() = "replaceAll" }
118+
predicate isGlobal() { RegExp::isGlobal(this.getRegExp().getFlags()) or this.getMethodName() = "replaceAll" }
119119

120120
/**
121121
* Holds if this call to `replace` replaces `old` with `new`.

javascript/ql/lib/semmle/javascript/dataflow/Nodes.qll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,9 +1682,6 @@ class RegExpCreationNode extends DataFlow::SourceNode {
16821682
result = this.(RegExpLiteralNode).getFlags()
16831683
}
16841684

1685-
/** Holds if the constructed predicate has the `g` flag. */
1686-
predicate isGlobal() { RegExp::isGlobal(this.getFlags()) }
1687-
16881685
/** Gets a data flow node referring to this regular expression. */
16891686
private DataFlow::SourceNode getAReference(DataFlow::TypeTracker t) {
16901687
t.start() and

0 commit comments

Comments
 (0)