CodeQL library for JavaScript

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.


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

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

Import path

import javascript
Node getAReferenceTo(string path)