polyglot.ast
Class Import_c
java.lang.Object
polyglot.ast.Node_c
polyglot.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.ast.Node_c |
addDecls, buildTypes, buildTypesEnter, checkConstants, childExpectedType, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, enterChildScope, enterScope, error, error, exceptionCheck, exceptionCheckEnter, ext, ext, ext, ext, init, isDisambiguated, isTypeChecked, node, position, position, prettyPrint, prettyPrint, 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, error, error, ext, ext, ext, ext, isDisambiguated, 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, buildTypesEnter, checkConstants, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, enterChildScope, enterScope, exceptionCheck, exceptionCheckEnter, prettyPrint, prettyPrint, throwTypes, translate, typeCheckEnter, typeCheckOverride, 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
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
- 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.