public class ClassLit_c extends Lit_c implements ClassLit
ClassLit
represents a class literal expression.
A class literal expressions is an expression consisting of the
name of a class, interface, array, or primitive type followed by a period (.)
and the token class.Term.Instance
Modifier and Type | Field and Description |
---|---|
protected TypeNode |
typeNode |
exceptions, reachable
Constructor and Description |
---|
ClassLit_c(Position pos,
TypeNode typeNode) |
ClassLit_c(Position pos,
TypeNode typeNode,
Ext ext) |
Modifier and Type | Method and Description |
---|---|
<T> java.util.List<T> |
acceptCFG(CFGBuilder<?> v,
java.util.List<T> succs)
Visit this term in evaluation order, calling v.edge() for each successor
in succs, if data flows on that edge.
|
java.lang.Object |
constantValue(Lang lang)
Return the constant value of the expression, if any.
|
Node |
copy(NodeFactory nf)
Produce a copy of this node using the given NodeFactory.
|
Term |
firstChild()
Return the first direct subterm performed when evaluating this term.
|
boolean |
isConstant(Lang lang)
According to the JLS 2nd Ed, sec 15.28, a class literal
is not a compile time constant.
|
java.lang.Object |
objValue()
Cannot return the correct object (except for maybe
some of the primitive arrays), so we just return null here.
|
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given
CodeWriter . |
protected <N extends ClassLit_c> |
reconstruct(N n,
TypeNode typeNode) |
java.lang.String |
toString() |
Node |
typeCheck(TypeChecker tc)
Type check the AST.
|
TypeNode |
typeNode() |
protected <N extends ClassLit_c> |
typeNode(N n,
TypeNode typeNode) |
ClassLit |
typeNode(TypeNode typeNode) |
Node |
visitChildren(NodeVisitor v)
Visit the children of the node.
|
constantValueSet, precedence
booleanValue, buildTypes, byteValue, charValue, constantValue, constantValueSet, doubleValue, dump, extRewrite, floatValue, intValue, isConstant, isTypeChecked, lastLang, longValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type, type
exceptionCheck, exceptions, exceptions, exceptions, listChild, reachable, reachable, reachable
addDecls, buildTypesEnter, checkConstants, childExpectedType, copy, copy, copyIfNeeded, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, error, error, error, exceptionCheckEnter, ext, ext, ext, ext, extRewriteEnter, isDisambiguated, lang, position, position, position, prettyPrint, prettyPrint, prettyPrint, prettyPrint, print, printBlock, printSubStmt, throwTypes, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitEdge, visitList
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
constantValue, constantValueSet, isConstant, precedence, printSubExpr, printSubExpr, type
del, del, dump, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitEdge
addDecls, buildTypes, 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, visitList
exceptions, exceptions, reachable, reachable
protected TypeNode typeNode
protected <N extends ClassLit_c> N typeNode(N n, TypeNode typeNode)
public java.lang.Object objValue()
public Term firstChild()
TermOps
firstChild
in interface TermOps
firstChild
in class Lit_c
public <T> java.util.List<T> acceptCFG(CFGBuilder<?> v, java.util.List<T> succs)
TermOps
protected <N extends ClassLit_c> N reconstruct(N n, TypeNode typeNode)
public Node visitChildren(NodeVisitor v)
NodeOps
visitChildren
in interface NodeOps
visitChildren
in class Node_c
v
- The visitor that will traverse/rewrite the AST.this
.public Node typeCheck(TypeChecker tc) throws SemanticException
NodeOps
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.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.public boolean isConstant(Lang lang)
isConstant
in interface ExprOps
isConstant
in class Lit_c
public java.lang.Object constantValue(Lang lang)
ExprOps
isConstant()
is true.constantValue
in interface ExprOps
constantValue
in class Lit_c