polyglot.visit
Class LocalClassRemover

java.lang.Object
  extended by polyglot.visit.NodeVisitor
      extended by polyglot.visit.HaltingVisitor
          extended by polyglot.visit.ErrorHandlingVisitor
              extended by polyglot.visit.ContextVisitor
                  extended by polyglot.visit.LocalClassRemover
All Implemented Interfaces:
java.lang.Cloneable, Copy

public class LocalClassRemover
extends ContextVisitor

Author:
nystrom This class translates local classes and anonymous classes to member classes. It adds fields to the classes for each local variable in the enclosing method that is used in the class body.

Field Summary
 
Fields inherited from class polyglot.visit.ContextVisitor
context, outer
 
Fields inherited from class polyglot.visit.ErrorHandlingVisitor
error, job, nf, ts
 
Constructor Summary
LocalClassRemover(Job job, TypeSystem ts, NodeFactory nf)
           
 
Method Summary
protected  NodeVisitor enterCall(Node n)
           
protected  boolean isLocal(ClassType ct)
           
protected  Node leaveCall(Node old, Node n, NodeVisitor v)
           
protected  java.lang.String namePrefix()
           
protected  java.lang.String newFieldName(java.lang.String name)
           
protected  void translateLocalClassBody(ParsedClassType ct, ClassBody body, Context context)
           
 
Methods inherited from class polyglot.visit.ContextVisitor
addDecls, begin, context, context, enter, enterScope, leave, superEnter
 
Methods inherited from class polyglot.visit.ErrorHandlingVisitor
catchErrors, enterCall, enterError, errorQueue, hasErrors, job, leaveCall, leaveCall, nodeFactory, typeSystem
 
Methods inherited from class polyglot.visit.HaltingVisitor
bypass, bypass, bypassChildren, override, visitChildren
 
Methods inherited from class polyglot.visit.NodeVisitor
copy, enter, finish, finish, leave, override, toString, visitEdge, visitEdgeNoOverride
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalClassRemover

public LocalClassRemover(Job job,
                         TypeSystem ts,
                         NodeFactory nf)
Method Detail

newFieldName

protected java.lang.String newFieldName(java.lang.String name)

namePrefix

protected java.lang.String namePrefix()

isLocal

protected boolean isLocal(ClassType ct)

leaveCall

protected Node leaveCall(Node old,
                         Node n,
                         NodeVisitor v)
                  throws SemanticException
Overrides:
leaveCall in class ErrorHandlingVisitor
Throws:
SemanticException

enterCall

protected NodeVisitor enterCall(Node n)
                         throws SemanticException
Overrides:
enterCall in class ErrorHandlingVisitor
Throws:
SemanticException

translateLocalClassBody

protected void translateLocalClassBody(ParsedClassType ct,
                                       ClassBody body,
                                       Context context)