File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
javascript/ql/lib/semmle/javascript Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -115,17 +115,13 @@ 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 ( ) {
119- RegExp:: isGlobal ( this .getRegExp ( ) .getFlags ( ) ) or this .getMethodName ( ) = "replaceAll"
120- }
118+ predicate isGlobal ( ) { this .getRegExp ( ) .isGlobal ( ) or this .getMethodName ( ) = "replaceAll" }
121119
122120 /**
123121 * Holds if this is a global replacement, that is, the first argument is a regular expression
124122 * with the `g` flag or unknown flags, or this is a call to `.replaceAll()`.
125123 */
126- predicate maybeGlobal ( ) {
127- RegExp:: maybeGlobal ( this .getRegExp ( ) .tryGetFlags ( ) ) or this .getMethodName ( ) = "replaceAll"
128- }
124+ predicate maybeGlobal ( ) { this .getRegExp ( ) .maybeGlobal ( ) or this .getMethodName ( ) = "replaceAll" }
129125
130126 /**
131127 * Holds if this call to `replace` replaces `old` with `new`.
Original file line number Diff line number Diff line change @@ -1682,6 +1682,12 @@ 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+
1688+ /** Holds if the constructed predicate has the `g` flag or unknown flags. */
1689+ predicate maybeGlobal ( ) { RegExp:: isGlobal ( this .tryGetFlags ( ) ) }
1690+
16851691 /** Gets a data flow node referring to this regular expression. */
16861692 private DataFlow:: SourceNode getAReference ( DataFlow:: TypeTracker t ) {
16871693 t .start ( ) and
You can’t perform that action at this time.
0 commit comments