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

Predicate AccessPath::getAReferenceTo

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

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

Examples:

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 || {});

Import path

import javascript
Node getAReferenceTo(string path)