jif.translate
Class JifToJavaRewriter

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 jif.translate.JifToJavaRewriter
All Implemented Interfaces:
java.lang.Cloneable, polyglot.util.Copy

public class JifToJavaRewriter
extends polyglot.visit.ContextVisitor

Visitor which performs rewriting on the AST.


Field Summary
protected  java.util.Collection additionalClassDecls
           
protected  java.util.List initializations
           
protected  java.util.Collection newSourceFiles
           
protected  java.util.List staticInitializations
           
 
Fields inherited from class polyglot.visit.ContextVisitor
context, outer, prune, rethrowMissingDependencies
 
Fields inherited from class polyglot.visit.ErrorHandlingVisitor
error, nf, ts
 
Fields inherited from class polyglot.visit.HaltingVisitor
bypass, bypassParent
 
Constructor Summary
JifToJavaRewriter(polyglot.frontend.Job job, JifTypeSystem jif_ts, JifNodeFactory jif_nf, polyglot.frontend.ExtensionInfo java_ext)
           
 
Method Summary
 void addAdditionalClassDecl(polyglot.ast.ClassDecl cd)
           
 void addInitializer(polyglot.ast.Block s)
           
 void addInitializer(polyglot.types.FieldInstance fi, polyglot.ast.Expr init)
           
 void addStaticInitializer(polyglot.ast.Block s)
           
protected  polyglot.ast.TypeNode canonical(polyglot.ast.NodeFactory nf, polyglot.types.Type t, polyglot.util.Position pos)
           
 polyglot.types.ClassType currentClass()
           
 polyglot.visit.NodeVisitor enterCall(polyglot.ast.Node n)
           
 void enteringClass(polyglot.types.ClassType t)
           
 polyglot.util.ErrorQueue errorQueue()
           
 void finish(polyglot.ast.Node ast)
           
 java.util.List getInitializations()
           
 java.util.List getStaticInitializations()
           
 boolean inConstructor()
           
 void inConstructor(boolean flag)
           
 polyglot.ast.NodeFactory java_nf()
           
 polyglot.types.TypeSystem java_ts()
           
 JifNodeFactory jif_nf()
           
 JifTypeSystem jif_ts()
           
 polyglot.ast.Expr labelToJava(Label label)
           
 polyglot.ast.Node leaveCall(polyglot.ast.Node old, polyglot.ast.Node n, polyglot.visit.NodeVisitor v)
           
 void leavingClass()
           
 polyglot.ast.Node leavingSourceFile(polyglot.ast.SourceFile n)
          Take any additional class declarations that can fit into the source file, i.e., non-public class decls.
 polyglot.ast.Expr paramToJava(Param param)
           
 polyglot.ast.Expr principalToJava(Principal principal)
           
 polyglot.qq.QQ qq()
           
 java.lang.String runtimeLabelUtil()
          The full class path of the runtime label utility.
 polyglot.ast.TypeNode typeToJava(polyglot.types.Type t, polyglot.util.Position pos)
           
 
Methods inherited from class polyglot.visit.ContextVisitor
addDecls, begin, context, context, enter, enter, enterScope, leave, rethrowMissingDependencies, superEnter
 
Methods inherited from class polyglot.visit.ErrorHandlingVisitor
catchErrors, enterCall, enterError, 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, finish, leave, override, toString, visitEdge, visitEdgeNoOverride
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

additionalClassDecls

protected java.util.Collection additionalClassDecls

newSourceFiles

protected java.util.Collection newSourceFiles

initializations

protected java.util.List initializations

staticInitializations

protected java.util.List staticInitializations
Constructor Detail

JifToJavaRewriter

public JifToJavaRewriter(polyglot.frontend.Job job,
                         JifTypeSystem jif_ts,
                         JifNodeFactory jif_nf,
                         polyglot.frontend.ExtensionInfo java_ext)
Method Detail

finish

public void finish(polyglot.ast.Node ast)
Overrides:
finish in class polyglot.visit.NodeVisitor

jif_ts

public JifTypeSystem jif_ts()

jif_nf

public JifNodeFactory jif_nf()

java_ts

public polyglot.types.TypeSystem java_ts()

java_nf

public polyglot.ast.NodeFactory java_nf()

errorQueue

public polyglot.util.ErrorQueue errorQueue()
Overrides:
errorQueue in class polyglot.visit.ErrorHandlingVisitor

enterCall

public polyglot.visit.NodeVisitor enterCall(polyglot.ast.Node n)
Overrides:
enterCall in class polyglot.visit.ErrorHandlingVisitor

leaveCall

public polyglot.ast.Node leaveCall(polyglot.ast.Node old,
                                   polyglot.ast.Node n,
                                   polyglot.visit.NodeVisitor v)
Overrides:
leaveCall in class polyglot.visit.ErrorHandlingVisitor

paramToJava

public polyglot.ast.Expr paramToJava(Param param)
                              throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

labelToJava

public polyglot.ast.Expr labelToJava(Label label)
                              throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

principalToJava

public polyglot.ast.Expr principalToJava(Principal principal)
                                  throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

typeToJava

public polyglot.ast.TypeNode typeToJava(polyglot.types.Type t,
                                        polyglot.util.Position pos)
                                 throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

canonical

protected polyglot.ast.TypeNode canonical(polyglot.ast.NodeFactory nf,
                                          polyglot.types.Type t,
                                          polyglot.util.Position pos)

qq

public polyglot.qq.QQ qq()

currentClass

public polyglot.types.ClassType currentClass()

enteringClass

public void enteringClass(polyglot.types.ClassType t)

leavingClass

public void leavingClass()

addInitializer

public void addInitializer(polyglot.ast.Block s)

addInitializer

public void addInitializer(polyglot.types.FieldInstance fi,
                           polyglot.ast.Expr init)
                    throws polyglot.types.SemanticException
Throws:
polyglot.types.SemanticException

getInitializations

public java.util.List getInitializations()

addStaticInitializer

public void addStaticInitializer(polyglot.ast.Block s)

getStaticInitializations

public java.util.List getStaticInitializations()

addAdditionalClassDecl

public void addAdditionalClassDecl(polyglot.ast.ClassDecl cd)

leavingSourceFile

public polyglot.ast.Node leavingSourceFile(polyglot.ast.SourceFile n)
Take any additional class declarations that can fit into the source file, i.e., non-public class decls.


inConstructor

public boolean inConstructor()

inConstructor

public void inConstructor(boolean flag)

runtimeLabelUtil

public java.lang.String runtimeLabelUtil()
The full class path of the runtime label utility.