CodeQL library for JavaScript/TypeScript
codeql/javascript-all 0.9.0 (changelog, source)
Search

Module AccessPath

Provides predicates for associating access paths with data flow nodes.

For example, AccessPath::getAReferenceTo(x) can be used to obtain the global access path that x refers to, as in the following sample:

function f() {
  let v = foo.bar; // reference to 'foo.bar'
  v.baz;           // reference to 'foo.bar.baz'
}

(function(ns) {
  ns.x;            // reference to 'NS.x'
})(NS = NS || {});

A pseudo-property named [number] is sometimes used to represent array indices within an access path.

Import path

import javascript

Predicates

getAReferenceOrAssignmentTo

Gets a node that refers to or is assigned to the given global access path.

getAReferenceOrAssignmentTo

Gets a node that refers to or is assigned to the given access path.

getAReferenceTo

Gets a node that refers to the given global access path.

getAReferenceTo

Gets a node that refers to the given access path relative to the given root node, or root itself if the access path is empty.

getAnAliasedSourceNode

Gets a SourceNode that refers to the same value or access path as the given node.

getAnAssignmentTo

Gets a node that is assigned to the given global access path.

getAnAssignmentTo

Gets a node that is assigned to the given access path relative to the given root node.

isAssignedInUniqueFile

Holds if the global accessPath is only assigned to from one file, not counting self-assignments.

step

Holds if there is a step from pred to succ through an assignment to an access path.

Classes

Root

A source node that can be the root of an access path.

Modules

DominatingPaths

A module for reasoning dominating reads and writes to access-paths.