polyglot.ext.jl.ast
Class Import_c
java.lang.Object
polyglot.ext.jl.ast.Node_c
polyglot.ext.jl.ast.Import_c
- All Implemented Interfaces:
- java.lang.Cloneable, Import, JL, Node, NodeOps, Copy
public class Import_c
- extends Node_c
- implements Import
An Import
is an immutable representation of a Java
import
statement. It consists of the string representing the
item being imported and the kind which is either indicating that a class
is being imported, or that an entire package is being imported.
Methods inherited from class polyglot.ext.jl.ast.Node_c |
addDecls, addMembers, addMembersEnter, addMembersOverride, buildTypesEnter, buildTypesOverride, childExpectedType, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, enterScope, enterScope, exceptionCheck, exceptionCheckEnter, exceptionCheckOverride, ext, ext, ext, ext, init, node, position, position, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitChildren, 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, buildTypesEnter, disambiguate, disambiguateEnter, enterScope, enterScope, exceptionCheck, exceptionCheckEnter, throwTypes, translate, typeCheckEnter, visitChildren |
Methods inherited from interface polyglot.util.Copy |
copy |
kind
protected Import.Kind kind
name
protected java.lang.String name
Import_c
public Import_c(Position pos,
Import.Kind kind,
java.lang.String name)
name
public java.lang.String name()
- Get the name of the import.
- Specified by:
name
in interface Import
name
public Import name(java.lang.String name)
- Set the name of the import.
- Specified by:
name
in interface Import
kind
public Import.Kind kind()
- Get the kind of the import.
- Specified by:
kind
in interface Import
kind
public Import kind(Import.Kind kind)
- Set the kind of the import.
- Specified by:
kind
in interface Import
buildTypes
public Node buildTypes(TypeBuilder tb)
throws SemanticException
- Build type objects for the import.
- Specified by:
buildTypes
in interface NodeOps
- Overrides:
buildTypes
in class Node_c
- Parameters:
tb
- The visitor which adds new type objects to the
TypeSystem
.
- Throws:
SemanticException
typeCheck
public Node typeCheck(TypeChecker tc)
throws SemanticException
- Check that imported classes and packages exist.
- Specified by:
typeCheck
in interface NodeOps
- Overrides:
typeCheck
in class Node_c
- Parameters:
tc
- The type checking visitor.
- Throws:
SemanticException
toString
public java.lang.String toString()
- Overrides:
toString
in class Node_c
prettyPrint
public void prettyPrint(CodeWriter w,
PrettyPrinter tr)
- Write the import to an output file.
- Specified by:
prettyPrint
in interface NodeOps
- Overrides:
prettyPrint
in class Node_c
- Parameters:
w
- The code writer to which to write.tr
- The pretty printer. This is not a visitor.