com.sun.tools.javac.comp
Class Lower.FreeVarCollector

java.lang.Object
  extended by com.sun.tools.javac.tree.JCTree.Visitor
      extended by com.sun.tools.javac.tree.TreeScanner
          extended by com.sun.tools.javac.comp.Lower.FreeVarCollector
Enclosing class:
Lower

 class Lower.FreeVarCollector
extends TreeScanner

A navigator class for collecting the free variables accessed from a local class. There is only one case; all other cases simply traverse down the tree.


Field Summary
(package private)  Symbol.ClassSymbol clazz
          The local class.
(package private)  List<Symbol.VarSymbol> fvs
          The list of owner's variables accessed from within the local class, without any duplicates.
(package private)  Symbol owner
          The owner of the local class.
 
Constructor Summary
Lower.FreeVarCollector(Symbol.ClassSymbol clazz)
           
 
Method Summary
private  void addFreeVar(Symbol.VarSymbol v)
          Add free variable to fvs list unless it is already there.
private  void addFreeVars(Symbol.ClassSymbol c)
          Add all free variables of class c to fvs list unless they are already there.
 void visitApply(JCTree.JCMethodInvocation tree)
          If tree refers to a superclass constructor call, add all free variables of the superclass.
 void visitIdent(JCTree.JCIdent tree)
          If tree refers to a variable in owner of local class, add it to free variables list.
 void visitNewClass(JCTree.JCNewClass tree)
          If tree refers to a class instance creation expression add all free variables of the freshly created class.
 void visitSelect(JCTree.JCFieldAccess tree)
          If tree refers to a qualified this or super expression for anything but the current class, add the outer this stack as a free variable.
private  void visitSymbol(Symbol _sym)
           
 
Methods inherited from class com.sun.tools.javac.tree.TreeScanner
scan, scan, visitAnnotation, visitAssert, visitAssign, visitAssignop, visitBinary, visitBlock, visitBracketExpr, visitBreak, visitCase, visitCatch, visitClassDef, visitConditional, visitContinue, visitDoLoop, visitErroneous, visitExec, visitForeachLoop, visitForLoop, visitIf, visitImport, visitIndexed, visitLabelled, visitLetExpr, visitLiteral, visitMethodDef, visitModifiers, visitNewArray, visitParens, visitReturn, visitSkip, visitSwitch, visitSynchronized, visitThrow, visitTopLevel, visitTree, visitTry, visitTypeApply, visitTypeArray, visitTypeBoundKind, visitTypeCast, visitTypeIdent, visitTypeParameter, visitTypeTest, visitUnary, visitVarDef, visitWhileLoop, visitWildcard
 
Methods inherited from class com.sun.tools.javac.tree.JCTree.Visitor
visitBracketStat, visitEscapeExpr, visitEscapeStat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

Symbol owner
The owner of the local class.


clazz

Symbol.ClassSymbol clazz
The local class.


fvs

List<Symbol.VarSymbol> fvs
The list of owner's variables accessed from within the local class, without any duplicates.

Constructor Detail

Lower.FreeVarCollector

Lower.FreeVarCollector(Symbol.ClassSymbol clazz)
Method Detail

addFreeVar

private void addFreeVar(Symbol.VarSymbol v)
Add free variable to fvs list unless it is already there.


addFreeVars

private void addFreeVars(Symbol.ClassSymbol c)
Add all free variables of class c to fvs list unless they are already there.


visitIdent

public void visitIdent(JCTree.JCIdent tree)
If tree refers to a variable in owner of local class, add it to free variables list.

Overrides:
visitIdent in class TreeScanner

visitSymbol

private void visitSymbol(Symbol _sym)

visitNewClass

public void visitNewClass(JCTree.JCNewClass tree)
If tree refers to a class instance creation expression add all free variables of the freshly created class.

Overrides:
visitNewClass in class TreeScanner

visitSelect

public void visitSelect(JCTree.JCFieldAccess tree)
If tree refers to a qualified this or super expression for anything but the current class, add the outer this stack as a free variable.

Overrides:
visitSelect in class TreeScanner

visitApply

public void visitApply(JCTree.JCMethodInvocation tree)
If tree refers to a superclass constructor call, add all free variables of the superclass.

Overrides:
visitApply in class TreeScanner