public class Import_c extends Node_c implements Import
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.Import.Kind
Modifier and Type | Field and Description |
---|---|
protected Import.Kind |
kind |
protected java.lang.String |
name |
SINGLE_TYPE, TYPE_IMPORT_ON_DEMAND
Constructor and Description |
---|
Import_c(Position pos,
Import.Kind kind,
java.lang.String name) |
Import_c(Position pos,
Import.Kind kind,
java.lang.String name,
Ext ext) |
Modifier and Type | Method and Description |
---|---|
Node |
buildTypes(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node
and constructs type objects for these.
|
Node |
copy(NodeFactory nf)
Produce a copy of this node using the given NodeFactory.
|
Import.Kind |
kind()
Get the kind of import.
|
Import |
kind(Import.Kind kind)
Set the kind of import.
|
protected <N extends Import_c> |
kind(N n,
Import.Kind kind) |
java.lang.String |
name()
Get the name of the class or package to import.
|
protected <N extends Import_c> |
name(N n,
java.lang.String name) |
Import |
name(java.lang.String name)
Set the name of the class or package to import.
|
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given
CodeWriter . |
java.lang.String |
toString() |
Node |
typeCheck(TypeChecker tc)
Check that imported classes and packages exist.
|
addDecls, buildTypesEnter, checkConstants, childExpectedType, copy, copy, copyIfNeeded, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, dump, enterChildScope, enterScope, error, error, error, exceptionCheck, exceptionCheckEnter, ext, ext, ext, ext, extRewrite, extRewriteEnter, isDisambiguated, isTypeChecked, lang, position, position, position, prettyPrint, prettyPrint, prettyPrint, prettyPrint, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitChildren, visitEdge, visitList
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
del, del, dump, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitEdge
addDecls, buildTypesEnter, checkConstants, childExpectedType, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, exceptionCheck, exceptionCheckEnter, extRewrite, extRewriteEnter, lang, prettyPrint, prettyPrint, prettyPrint, prettyPrint, throwTypes, translate, typeCheckEnter, typeCheckOverride, visitChild, visitChildren, visitList
protected Import.Kind kind
protected java.lang.String name
public Import_c(Position pos, Import.Kind kind, java.lang.String name)
public Import_c(Position pos, Import.Kind kind, java.lang.String name, Ext ext)
public java.lang.String name()
Import
public Import name(java.lang.String name)
Import
protected <N extends Import_c> N name(N n, java.lang.String name)
public Import.Kind kind()
Import
public Import kind(Import.Kind kind)
Import
protected <N extends Import_c> N kind(N n, Import.Kind kind)
public Node buildTypes(TypeBuilder tb)
NodeOps
TypeSystem
.
This method is called by the leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.buildTypes
in interface NodeOps
buildTypes
in class Node_c
tb
- The visitor which adds new type objects to the
TypeSystem
.public Node typeCheck(TypeChecker tc) throws SemanticException
typeCheck
in interface NodeOps
typeCheck
in class Node_c
tc
- The type checking visitor.SemanticException
public void prettyPrint(CodeWriter w, PrettyPrinter tr)
Node_c
CodeWriter
.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.