|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpolyglot.ext.jl.ast.Node_c
polyglot.ext.jl.ast.SourceFile_c
public class SourceFile_c
A SourceFile
is an immutable representations of a Java
langauge source file. It consists of a package name, a list of
Import
s, and a list of GlobalDecl
s.
Field Summary | |
---|---|
protected java.util.List |
decls
|
protected java.util.List |
imports
|
protected ImportTable |
importTable
|
protected PackageNode |
package_
|
protected Source |
source
|
Fields inherited from class polyglot.ext.jl.ast.Node_c |
---|
del, ext, position |
Constructor Summary | |
---|---|
SourceFile_c(Position pos,
PackageNode package_,
java.util.List imports,
java.util.List decls)
|
Method Summary | |
---|---|
Node |
buildTypes(TypeBuilder tb)
Build type objects for the source file. |
NodeVisitor |
buildTypesEnter(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. |
Context |
enterScope(Context c)
Push a new scope upon entering this node, and add any declarations to the context that should be in scope when visiting children of this node. |
java.util.List |
imports()
Get the imports of the source file. |
SourceFile |
imports(java.util.List imports)
Set the imports of the source file. |
ImportTable |
importTable()
Get the declarations of the source file. |
SourceFile |
importTable(ImportTable importTable)
Set the declarations of the source file. |
PackageNode |
package_()
Get the package of the source file. |
SourceFile |
package_(PackageNode package_)
Set the package of the source file. |
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Write the source file to an output file. |
protected SourceFile_c |
reconstruct(PackageNode package_,
java.util.List imports,
java.util.List decls)
Reconstruct the source file. |
Source |
source()
Get the source of the source file. |
SourceFile |
source(Source source)
Set the source of the source file. |
java.lang.String |
toString()
|
Node |
typeCheck(TypeChecker tc)
Type check the source file. |
Node |
visitChildren(NodeVisitor v)
Visit the children of the source file. |
Methods inherited from class polyglot.ext.jl.ast.Node_c |
---|
addDecls, addMembers, addMembersEnter, addMembersOverride, buildTypesOverride, childExpectedType, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, enterScope, exceptionCheck, exceptionCheckEnter, exceptionCheckOverride, ext, ext, ext, ext, init, node, position, position, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitEdge, visitList |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface polyglot.ast.Node |
---|
childExpectedType, del, del, dump, ext, ext, ext, ext, position, position, visit, visitChild, visitEdge, visitList |
Methods inherited from interface polyglot.ast.JL |
---|
init, node |
Methods inherited from interface polyglot.ast.NodeOps |
---|
addDecls, addMembers, addMembersEnter, disambiguate, disambiguateEnter, enterScope, exceptionCheck, exceptionCheckEnter, throwTypes, translate, typeCheckEnter |
Methods inherited from interface polyglot.util.Copy |
---|
copy |
Field Detail |
---|
protected PackageNode package_
protected java.util.List imports
protected java.util.List decls
protected ImportTable importTable
protected Source source
Constructor Detail |
---|
public SourceFile_c(Position pos, PackageNode package_, java.util.List imports, java.util.List decls)
Method Detail |
---|
public Source source()
source
in interface SourceFile
public SourceFile source(Source source)
source
in interface SourceFile
public PackageNode package_()
package_
in interface SourceFile
public SourceFile package_(PackageNode package_)
package_
in interface SourceFile
public java.util.List imports()
imports
in interface SourceFile
Import
.public SourceFile imports(java.util.List imports)
imports
in interface SourceFile
imports
- A list of Import
.public java.util.List decls()
decls
in interface SourceFile
TopLevelDecl
.public SourceFile decls(java.util.List decls)
decls
in interface SourceFile
decls
- A list of TopLevelDecl
.public ImportTable importTable()
importTable
in interface SourceFile
public SourceFile importTable(ImportTable importTable)
importTable
in interface SourceFile
protected SourceFile_c reconstruct(PackageNode package_, java.util.List imports, java.util.List decls)
public Node visitChildren(NodeVisitor v)
visitChildren
in interface NodeOps
visitChildren
in class Node_c
v
- The visitor that will traverse/rewrite the AST.
this
.public NodeVisitor buildTypesEnter(TypeBuilder tb) throws SemanticException
buildTypesEnter
in interface NodeOps
buildTypesEnter
in class Node_c
tb
- The visitor which adds new type objects to the
TypeSystem
.
SemanticException
public Node buildTypes(TypeBuilder tb) throws SemanticException
buildTypes
in interface NodeOps
buildTypes
in class Node_c
tb
- The visitor which adds new type objects to the
TypeSystem
.
SemanticException
public Context enterScope(Context c)
Node_c
enterScope
in interface NodeOps
enterScope
in class Node_c
c
- the current Context
Context
to be used for visiting this node.public Node typeCheck(TypeChecker tc) throws SemanticException
typeCheck
in interface NodeOps
typeCheck
in class Node_c
tc
- The type checking visitor.
SemanticException
public java.lang.String toString()
toString
in class Node_c
public void prettyPrint(CodeWriter w, PrettyPrinter tr)
prettyPrint
in interface NodeOps
prettyPrint
in class Node_c
w
- The code writer to which to write.tr
- The pretty printer. This is not a visitor.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |