Class DefUse::VarDef

A ControlFlowNode that defines (that is, initializes or updates) variables or properties.

The following program elements are definitions:

  • assignment expressions (x = 42)
  • update expressions (++x)
  • variable declarators with an initializer (var x = 42)
  • for-in and for-of statements (for (x in o) { ... })
  • parameters of functions or catch clauses (function (x) { ... })
  • named functions (function x() { ... })
  • named classes (class x { ... })
  • import specifiers (import { x } from 'm')

Note that due to destructuring, a single VarDef may define multiple variables and/or properties; for example, { x, y: z.p } = e defines variable x as well as property p of z.

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

getAVariable

Gets a variable defined by this node, if any.

getDestructuringSource

Gets the source that this definition destructs, that is, the right hand side of a destructuring assignment.

getSource

Gets the source of this definition, that is, the data flow node representing the value that this definition assigns to its target.

getTarget

Gets the target of this definition, which is either a simple variable reference, a destructuring pattern, or a property access.

isOverwritten

Holds if this definition of v is overwritten by another definition, that is, another definition of v is reachable from it in the CFG.

Inherited predicates

describeControlFlowNode

For internal use.

from ControlFlowNode
getAPredecessor

Gets a node preceding this node in the CFG.

from ControlFlowNode
getASuccessor

Gets a node succeeding this node in the CFG.

from ControlFlowNode
getBasicBlock

Gets the basic block this node belongs to.

from ControlFlowNode
getContainer

Gets the function or toplevel whose CFG this node belongs to.

from ControlFlowNode
getEndLine

Gets the line on which this element ends.

from Locatable
getFile

Gets the file this program element comes from.

from Locatable
getLocation

Gets this element’s location.

from Locatable
getNumLines

Gets the number of lines covered by this element.

from Locatable
getStartLine

Gets the line on which this element starts.

from Locatable
isAFinalNode

Holds if this is a final node, that is, a CFG node where execution of a toplevel or function terminates.

from ControlFlowNode
isBranch

Holds if this is a node with more than one successor.

from ControlFlowNode
isJoin

Holds if this is a node with more than one predecessor.

from ControlFlowNode
isStart

Holds if this is a start node, that is, the CFG node where execution of a toplevel or function begins.

from ControlFlowNode
isUnreachable

Holds if this node is unreachable, that is, it has no predecessors in the CFG. Entry nodes are always considered reachable.

from ControlFlowNode
toString

Gets a textual representation of this element.

from Locatable

Charpred