|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectpolyglot.ast.Node_c
polyglot.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
Imports, and a list of GlobalDecls.
| 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.ast.Node_c |
|---|
del, error, ext, position |
| Constructor Summary | |
|---|---|
SourceFile_c(Position pos,
PackageNode package_,
java.util.List imports,
java.util.List decls)
|
|
| Method Summary | |
|---|---|
NodeVisitor |
buildTypesEnter(TypeBuilder tb)
Build type objects for the source file. |
Node |
copy(NodeFactory nf)
Produce a copy of this node using the given NodeFactory. |
java.util.List |
decls()
Get the declarations of the source file. |
SourceFile |
decls(java.util.List decls)
Set the declarations of the source file. |
Node |
disambiguateOverride(Node parent,
AmbiguityRemover ar)
Disambiguate the AST. |
void |
dump(CodeWriter w)
Dump the AST node for debugging purposes. |
Context |
enterScope(Context c)
Build type objects for 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. |
ImportTable |
importTable()
Get the declarations of the source file. |
SourceFile |
importTable(ImportTable importTable)
Set the declarations of the source file. |
boolean |
isDisambiguated()
|
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.ast.Node_c |
|---|
addDecls, buildTypes, checkConstants, childExpectedType, copy, copy, del, del, disambiguate, disambiguateEnter, dump, dump, enterChildScope, error, error, exceptionCheck, exceptionCheckEnter, ext, ext, ext, ext, init, isTypeChecked, node, position, position, prettyPrint, prettyPrint, 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, error, error, ext, ext, ext, ext, isTypeChecked, position, position, visit, visitChild, visitEdge, visitList |
| Methods inherited from interface polyglot.ast.JL |
|---|
init, node |
| Methods inherited from interface polyglot.ast.NodeOps |
|---|
addDecls, buildTypes, checkConstants, copy, disambiguate, disambiguateEnter, dump, dump, enterChildScope, exceptionCheck, exceptionCheckEnter, prettyPrint, prettyPrint, throwTypes, translate, typeCheckEnter, typeCheckOverride |
| 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 boolean isDisambiguated()
isDisambiguated in interface NodeisDisambiguated in class Node_cpublic Source source()
source in interface SourceFilepublic SourceFile source(Source source)
source in interface SourceFilepublic PackageNode package_()
package_ in interface SourceFilepublic SourceFile package_(PackageNode package_)
package_ in interface SourceFilepublic java.util.List imports()
imports in interface SourceFileImport.public SourceFile imports(java.util.List imports)
imports in interface SourceFileimports - A list of Import.public java.util.List decls()
decls in interface SourceFileTopLevelDecl.public SourceFile decls(java.util.List decls)
decls in interface SourceFiledecls - A list of TopLevelDecl.public ImportTable importTable()
importTable in interface SourceFilepublic 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 NodeOpsvisitChildren in class Node_cv - The visitor that will traverse/rewrite the AST.
this.
public NodeVisitor buildTypesEnter(TypeBuilder tb)
throws SemanticException
buildTypesEnter in interface NodeOpsbuildTypesEnter in class Node_ctb - The visitor which adds new type objects to the
TypeSystem.
SemanticExceptionpublic Context enterScope(Context c)
enterScope in interface NodeOpsenterScope in class Node_cc - the current Context
Context to be used for visiting this node.
public Node typeCheck(TypeChecker tc)
throws SemanticException
typeCheck in interface NodeOpstypeCheck in class Node_ctc - The type checking visitor.
SemanticExceptionpublic java.lang.String toString()
toString in class Node_c
public void prettyPrint(CodeWriter w,
PrettyPrinter tr)
prettyPrint in interface NodeOpsprettyPrint in class Node_cw - The code writer to which to write.tr - The pretty printer. This is not a visitor.
public Node disambiguateOverride(Node parent,
AmbiguityRemover ar)
throws SemanticException
NodeOpsoverride() method of the
visitor. If this method returns non-null, the node's children
will not be visited automatically. Thus, the method should check
both the node this and it's children, usually by
invoking visitChildren with tc or
with another visitor, returning a non-null node. OR, the method
should do nothing and simply return null to allow
enter, visitChildren, and leave
to be invoked on the node.
The default implementation returns null.
Overriding of this method is discouraged, but sometimes necessary.
disambiguateOverride in interface NodeOpsdisambiguateOverride in class Node_cparent - ar -
SemanticExceptionpublic void dump(CodeWriter w)
Node
dump in interface Nodedump in class Node_cpublic Node copy(NodeFactory nf)
NodeOps
copy in interface NodeOpscopy in class Node_c
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||