jif.translate

## Class JifToJavaRewriter

- java.lang.Object
- - polyglot.visit.NodeVisitor
  - - polyglot.visit.HaltingVisitor
    - - polyglot.visit.ErrorHandlingVisitor
      - - polyglot.visit.ContextVisitor
        - - jif.translate.JifToJavaRewriter

- All Implemented Interfaces:
    java.lang.Cloneable, polyglot.util.Copy<polyglot.visit.NodeVisitor>

      public class JifToJavaRewriter
      extends polyglot.visit.ContextVisitor

  Visitor which performs rewriting on the AST.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface polyglot.util.Copy

      `polyglot.util.Copy.Util`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Collection<polyglot.ast.ClassDecl>` | `additionalClassDecls`
    `protected java.util.List<polyglot.ast.Stmt>` | `initializations`
    `protected polyglot.frontend.ExtensionInfo` | `java_ext`
    `protected JifNodeFactory` | `jif_nf`
    `protected JifTypeSystem` | `jif_ts`
    `protected java.util.Collection<polyglot.ast.SourceFile>` | `newSourceFiles`
    `protected polyglot.qq.QQ` | `qq`
    `protected java.util.List<polyglot.ast.Block>` | `staticInitializations`

    - ### Fields inherited from class polyglot.visit.ContextVisitor

      `context, outer, prune, rethrowMissingDependencies`

    - ### Fields inherited from class polyglot.visit.ErrorHandlingVisitor

      `error, job, nf, ts`

    - ### Fields inherited from class polyglot.visit.HaltingVisitor

      `bypass, bypassParent`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JifToJavaRewriter(polyglot.frontend.Job job, JifTypeSystem jif_ts, JifNodeFactory jif_nf, polyglot.frontend.ExtensionInfo java_ext)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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)`
    `JifToJavaRewriter` | `copy()`
    `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<polyglot.ast.Stmt>` | `getInitializations()`
    `java.util.List<polyglot.ast.Block>` | `getStaticInitializations()`
    `java.lang.Boolean` | `haveThisCall()`
    `void` | `haveThisCall(boolean value)`
    `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.Expr` | `labelToJava(Label label, boolean simplify)`
    `polyglot.ast.Expr` | `labelToJava(Label label, polyglot.ast.Expr thisQualifier)`
    `polyglot.ast.Expr` | `labelToJava(Label label, polyglot.ast.Expr thisQualifier, boolean simplify)`
    `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` | `paramToJava(Param param, polyglot.ast.Expr thisQualifier)`
    `polyglot.ast.Expr` | `principalToJava(Principal principal)`
    `polyglot.ast.Expr` | `principalToJava(Principal principal, polyglot.ast.Expr thisQualifier)`
    `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, 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

      `finish, lang, leave, override, toString, visitEdge, visitEdgeNoOverride`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### java_ext

          protected polyglot.frontend.ExtensionInfo java_ext

    - #### jif_ts

          protected JifTypeSystem jif_ts

    - #### jif_nf

          protected JifNodeFactory jif_nf

    - #### qq

          protected polyglot.qq.QQ qq

    - #### additionalClassDecls

          protected java.util.Collection<polyglot.ast.ClassDecl> additionalClassDecls

    - #### newSourceFiles

          protected java.util.Collection<polyglot.ast.SourceFile> newSourceFiles

    - #### initializations

          protected java.util.List<polyglot.ast.Stmt> initializations

    - #### staticInitializations

          protected java.util.List<polyglot.ast.Block> staticInitializations

  - ### Constructor Detail

    - #### JifToJavaRewriter

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

  - ### Method Detail

    - #### copy

          public JifToJavaRewriter copy()

      Specified by:
        `copy` in interface `polyglot.util.Copy<polyglot.visit.NodeVisitor>`
      Overrides:
        `copy` in class `polyglot.visit.NodeVisitor`

    - #### 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`

    - #### paramToJava

          public polyglot.ast.Expr paramToJava(Param param,
                                               polyglot.ast.Expr thisQualifier)
                                        throws polyglot.types.SemanticException

      Parameters:
        `thisQualifier` - an Expr representing the translated "this" reference.
      Throws:
        `polyglot.types.SemanticException`

    - #### labelToJava

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

      Throws:
        `polyglot.types.SemanticException`

    - #### labelToJava

          public polyglot.ast.Expr labelToJava(Label label,
                                               boolean simplify)
                                        throws polyglot.types.SemanticException

      Parameters:
        `simplify` - whether to attempt to simplify the label when it's constructed at run time.
      Throws:
        `polyglot.types.SemanticException`

    - #### labelToJava

          public polyglot.ast.Expr labelToJava(Label label,
                                               polyglot.ast.Expr thisQualifier)
                                        throws polyglot.types.SemanticException

      Parameters:
        `thisQualifier` - an Expr representing the translated "this" reference.
      Throws:
        `polyglot.types.SemanticException`

    - #### labelToJava

          public polyglot.ast.Expr labelToJava(Label label,
                                               polyglot.ast.Expr thisQualifier,
                                               boolean simplify)
                                        throws polyglot.types.SemanticException

      Parameters:
        `thisQualifier` - an Expr representing the translated "this" reference.
        `simplify` - whether to attempt to simplify the label when it's constructed at run time.
      Throws:
        `polyglot.types.SemanticException`

    - #### principalToJava

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

      Throws:
        `polyglot.types.SemanticException`

    - #### principalToJava

          public polyglot.ast.Expr principalToJava(Principal principal,
                                                   polyglot.ast.Expr thisQualifier)
                                            throws polyglot.types.SemanticException

      Parameters:
        `thisQualifier` - an Expr representing the translated "this" reference.
      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<polyglot.ast.Stmt> getInitializations()

    - #### addStaticInitializer

          public void addStaticInitializer(polyglot.ast.Block s)

    - #### getStaticInitializations

          public java.util.List<polyglot.ast.Block> 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)

    - #### haveThisCall

          public java.lang.Boolean haveThisCall()

    - #### haveThisCall

          public void haveThisCall(boolean value)

    - #### runtimeLabelUtil

          public java.lang.String runtimeLabelUtil()

      The full class path of the runtime label utility.