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

Predicate AccessPath::getAnAssignmentTo

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

Only gets the immediate right-hand side of an assignment or property, not nodes that transitively flow there.

For example, the class nodes below are all assignments to (x, "foo.bar").

function f(x) {
  x.foo.bar = class {};
  x.foo = { bar: class {} };
  let alias = x;
  alias.foo.bar = class {};
}

Import path

import javascript
Node getAnAssignmentTo(Root root, string path)