jltools.ext.jl.ast
Class SourceFile_c

java.lang.Object
  |
  +--jltools.ext.jl.ast.Node_c
        |
        +--jltools.ext.jl.ast.SourceFile_c
All Implemented Interfaces:
java.lang.Cloneable, Copy, Node, java.io.Serializable, SourceFile

public class SourceFile_c
extends Node_c
implements SourceFile

A SourceFile is an immutable representations of a Java langauge source file. It consists of a package name, a list of Imports, and a list of GlobalDecls.

See Also:
Serialized Form

Inner classes inherited from class jltools.ext.jl.ast.Node_c
Node_c.StringCodeWriter
 
Field Summary
protected  java.util.List decls
           
protected  java.util.List imports
           
protected  PackageNode package_
           
 
Fields inherited from class jltools.ext.jl.ast.Node_c
ext, position
 
Constructor Summary
SourceFile_c(Ext ext, Position pos, PackageNode package_, java.util.List imports, java.util.List decls)
           
 
Method Summary
 Node buildTypesOverride_(TypeBuilder tb)
          Build type objects for the source file.
 java.util.List decls()
          Get the declarations of the source file.
 SourceFile decls(java.util.List decls)
          Set the declarations of the source file.
 java.util.List imports()
          Get the imports of the source file.
 SourceFile imports(java.util.List imports)
          Set the imports of the source file.
 PackageNode package_()
          Get the package of the source file.
 SourceFile package_(PackageNode package_)
          Set the package of the source file.
protected  SourceFile_c reconstruct(PackageNode package_, java.util.List imports, java.util.List decls)
          Reconstruct the source file.
 java.lang.String toString()
           
 void translate_(CodeWriter w, Translator tr)
          Write the source file to an output file.
 Node typeCheck_(TypeChecker tc)
          Type check the source file.
 Node visitChildren(NodeVisitor v)
          Visit the children of the source file.
 
Methods inherited from class jltools.ext.jl.ast.Node_c
buildTypes_, buildTypes, buildTypesOverride, copy, disambiguate_, disambiguate, disambiguateOverride_, disambiguateOverride, disambiguateTypes_, disambiguateTypes, disambiguateTypesOverride_, disambiguateTypesOverride, dump, enterScope, exceptionCheck_, exceptionCheck, exceptionCheckOverride_, exceptionCheckOverride, ext, ext, foldConstants_, foldConstants, foldConstantsOverride_, foldConstantsOverride, leaveScope, position, position, reconstructTypes_, reconstructTypes, translate, translateBlock, translateSubstmt, typeCheck, typeCheckOverride_, typeCheckOverride, visit, visitList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jltools.ast.Node
buildTypes_, copy, disambiguate_, disambiguateOverride_, disambiguateTypes_, disambiguateTypesOverride_, dump, enterScope, exceptionCheck_, exceptionCheckOverride_, ext, ext, foldConstants_, foldConstantsOverride_, leaveScope, position, position, reconstructTypes_, typeCheckOverride_, visit
 

Field Detail

package_

protected PackageNode package_

imports

protected java.util.List imports

decls

protected java.util.List decls
Constructor Detail

SourceFile_c

public SourceFile_c(Ext ext,
                    Position pos,
                    PackageNode package_,
                    java.util.List imports,
                    java.util.List decls)
Method Detail

package_

public PackageNode package_()
Get the package of the source file.
Specified by:
package_ in interface SourceFile

package_

public SourceFile package_(PackageNode package_)
Set the package of the source file.
Specified by:
package_ in interface SourceFile

imports

public java.util.List imports()
Get the imports of the source file.
Specified by:
imports in interface SourceFile

imports

public SourceFile imports(java.util.List imports)
Set the imports of the source file.
Specified by:
imports in interface SourceFile

decls

public java.util.List decls()
Get the declarations of the source file.
Specified by:
decls in interface SourceFile

decls

public SourceFile decls(java.util.List decls)
Set the declarations of the source file.
Specified by:
decls in interface SourceFile

reconstruct

protected SourceFile_c reconstruct(PackageNode package_,
                                   java.util.List imports,
                                   java.util.List decls)
Reconstruct the source file.

visitChildren

public Node visitChildren(NodeVisitor v)
Visit the children of the source file.
Specified by:
visitChildren in interface Node
Overrides:
visitChildren in class Node_c

buildTypesOverride_

public Node buildTypesOverride_(TypeBuilder tb)
                         throws SemanticException
Build type objects for the source file. Set the package before we recurse into the declarations.
Specified by:
buildTypesOverride_ in interface Node
Overrides:
buildTypesOverride_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
cb - The visitor which adds new type objects to the TypeSystem.

typeCheck_

public Node typeCheck_(TypeChecker tc)
                throws SemanticException
Type check the source file.
Specified by:
typeCheck_ in interface Node
Overrides:
typeCheck_ in class Node_c

toString

public java.lang.String toString()
Overrides:
toString in class Node_c

translate_

public void translate_(CodeWriter w,
                       Translator tr)
Write the source file to an output file.
Specified by:
translate_ in interface Node
Overrides:
translate_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
w - The code writer to which to write.
tr - The translation pass. This is not a visitor.