|
|||||||||
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
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.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 Node
isDisambiguated
in class Node_c
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 Context enterScope(Context 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.public Node disambiguateOverride(Node parent, AmbiguityRemover ar) throws SemanticException
NodeOps
override()
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 NodeOps
disambiguateOverride
in class Node_c
parent
- ar
-
SemanticException
public void dump(CodeWriter w)
Node
dump
in interface Node
dump
in class Node_c
public Node copy(NodeFactory nf)
NodeOps
copy
in interface NodeOps
copy
in class Node_c
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |