Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f43e843

Browse files
author
Max Schaefer
committed
JavaScript: Introduce class RegExpLiteralNode.
1 parent 12ea81a commit f43e843

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

  • javascript/ql/src/semmle/javascript/dataflow

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,24 @@ class ArrayLiteralNode extends DataFlow::ValueNode, DataFlow::SourceNode {
530530
int getSize() { result = astNode.getSize() }
531531
}
532532

533+
/**
534+
* A data-flow node corresponding to a regular-expression literal.
535+
*
536+
* Examples:
537+
* ```js
538+
* /https?/i
539+
* ```
540+
*/
541+
class RegExpLiteralNode extends DataFlow::ValueNode, DataFlow::SourceNode {
542+
override RegExpLiteral astNode;
543+
544+
/** Holds if this regular expression has a `g` flag. */
545+
predicate isGlobal() { astNode.isGlobal() }
546+
547+
/** Gets the root term of this regular expression. */
548+
RegExpTerm getRoot() { result = astNode.getRoot() }
549+
}
550+
533551
/**
534552
* A data flow node corresponding to a `new Array()` or `Array()` invocation.
535553
*

0 commit comments

Comments
 (0)