Node node = getNodeFromSomewhere();
InstanceVariableFinder finder = new InstanceVariableFinder();
node.accept(finder);
System.out.println("found: " + finder.getFoundVariables);
| Modifier and Type | Field and Description |
|---|---|
| private final Set | foundVariables
The set of instance variables found during walking. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Void | defaultVisit(Node iVisited)
Implements abstract org.
|
| public static Set | Returns: an array of instance variable names foundthe node to walk node)Walk a node and its children looking for instance variables using a new InstanceVariableFinder. |
| public Set | Returns: a Set of all instance variable names foundReturn the Set of all instance variables found during walking. |
| public Void | Returns: nullOverrides org. Implements org. ClassNode creates a new scope and self, so do not search for ivars. |
| public Void | Returns: nullOverrides org. Implements org. Add the name of the instance variable being assigned to our set of instance variable names and continue to walk child nodes. |
| public Void | Returns: nullOverrides org. Implements org. Add the name of the instance variable being retrieved to our set of instance variable names and continue to walk child nodes. |
| public Void | Returns: nullOverrides org. Implements org. ModuleNode creates a new scope and self, so do not search for ivars. |
| public Void | |
| public Void | Returns: nullOverrides org. Implements org. PostExeNode can't appear in methods, so do not search for ivars. |
| public Void | Returns: nullOverrides org. Implements org. PreExeNode can't appear in methods, so do not search for ivars. |
| foundVariables | back to summary |
|---|---|
| private final Set<RubySymbol> foundVariables The set of instance variables found during walking. | |
| InstanceVariableFinder | back to summary |
|---|---|
| public InstanceVariableFinder() | |
| defaultVisit | back to summary |
|---|---|
| protected Void defaultVisit(Node iVisited) Implements abstract org.
| |
| findVariables | back to summary |
|---|---|
| public static Set Walk a node and its children looking for instance variables using a new InstanceVariableFinder. Return an array of the variable names found.
| |
| getFoundVariables | back to summary |
|---|---|
| public Set Return the Set of all instance variables found during walking.
| |
| visitClassNode | back to summary |
|---|---|
| public Void visitClassNode(ClassNode iVisited) Overrides org. Implements org. ClassNode creates a new scope and self, so do not search for ivars. | |
| visitInstAsgnNode | back to summary |
|---|---|
| public Void visitInstAsgnNode(InstAsgnNode iVisited) Overrides org. Implements org. Add the name of the instance variable being assigned to our set of instance variable names and continue to walk child nodes. | |
| visitInstVarNode | back to summary |
|---|---|
| public Void visitInstVarNode(InstVarNode iVisited) Overrides org. Implements org. Add the name of the instance variable being retrieved to our set of instance variable names and continue to walk child nodes. | |
| visitModuleNode | back to summary |
|---|---|
| public Void visitModuleNode(ModuleNode iVisited) Overrides org. Implements org. ModuleNode creates a new scope and self, so do not search for ivars. | |
| visitNilRestArgNode | back to summary |
|---|---|
| public Void visitNilRestArgNode(NilRestArgNode iVisited) Overrides org. Implements org.
| |
| visitPostExeNode | back to summary |
|---|---|
| public Void visitPostExeNode(PostExeNode iVisited) Overrides org. Implements org. PostExeNode can't appear in methods, so do not search for ivars. | |
| visitPreExeNode | back to summary |
|---|---|
| public Void visitPreExeNode(PreExeNode iVisited) Overrides org. Implements org. PreExeNode can't appear in methods, so do not search for ivars. | |