CodeQL library for JavaScript
Search

Predicate AccessPath::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.

This works for direct references as well as for aliases established through local data flow.

For example:

function f(x) {
  let a = x.f.g; // reference to (x, "f.g")
  let b = a.h;   // reference to (x, "f.g.h")
}

Import path

import javascript
Node getAReferenceTo(Root root, string path)