DartBlockProgramTreeNode class sealed

The tree-based representation of a DartBlock component (Statement, Function) as a node.

A node can have an optional parent node, as well as a list of child nodes.

The purpose of this tree representation is to primarily keep track of the variable scopes. As such, by traversing upward from a given node, we can determine the variables which have already been declared and which are usable in the current scope.

A second usage of this tree representation is to enable the evaluation schema DartBlockVariableCountEvaluationSchema.


Technical details:

Implementers

Properties

children List<DartBlockProgramTreeNode>
The list of child nodes.
final
hashCode int
The hash code for this object.
no setterinherited
key int
A unique key which the node is associated with.
final
parent DartBlockProgramTreeNode?
The parent node.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

findAllVariableDefinitions() List<DartBlockVariableDefinition>
Retrieve all variable definitions in the current node and its child nodes.
findNodeByKey(int key) DartBlockProgramTreeNode?
Return this node if its key matches. Otherwise, perform downward traversal to find matches in the child nodes.
findVariableDefinitions(int key, {bool includeNode = false}) List<DartBlockVariableDefinition>
Retrieve the list of variables defined in the scope given by the starting node, based on its key. Based on the starting node, upward traversal is used to find all preceding variable definitions.
getMaxDepth() int
Get the depth of this node.
getStatementTypeUsageCount() Map<StatementType, int>
Count the number of usage of each StatementType by way of downward traversal.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited