polyglot.ast
Class ClassLit_c
java.lang.Object
polyglot.ast.Node_c
polyglot.ast.Term_c
polyglot.ast.Expr_c
polyglot.ast.Lit_c
polyglot.ast.ClassLit_c
- All Implemented Interfaces:
- java.lang.Cloneable, ClassLit, Expr, JL, Lit, Node, NodeOps, Prefix, Receiver, Term, Typed, Copy
public class ClassLit_c
- extends Lit_c
- implements ClassLit
A 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.
| Fields inherited from class polyglot.ast.Expr_c |
type |
| Methods inherited from class polyglot.ast.Expr_c |
booleanValue, buildTypes, byteValue, charValue, doubleValue, dump, floatValue, intValue, isTypeChecked, longValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type |
| Methods inherited from class polyglot.ast.Node_c |
addDecls, buildTypesEnter, checkConstants, childExpectedType, copy, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, enterChildScope, enterScope, error, error, exceptionCheckEnter, ext, ext, ext, ext, init, isDisambiguated, 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, 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, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, enterChildScope, enterScope, exceptionCheck, exceptionCheckEnter, prettyPrint, prettyPrint, throwTypes, translate, typeCheckEnter, typeCheckOverride |
| Methods inherited from interface polyglot.util.Copy |
copy |
| Methods inherited from interface polyglot.ast.Typed |
type |
typeNode
protected TypeNode typeNode
ClassLit_c
public ClassLit_c(Position pos,
TypeNode typeNode)
typeNode
public TypeNode typeNode()
- Specified by:
typeNode in interface ClassLit
typeNode
public ClassLit typeNode(TypeNode typeNode)
objValue
public java.lang.Object objValue()
- Cannot return the correct object (except for maybe
some of the primitive arrays), so we just return null here.
firstChild
public Term firstChild()
- Description copied from interface:
Term
- Return the first direct subterm performed when evaluating this term. If
this term has no subterms, this should return null.
This method is similar to the deprecated entry(), but it should *not*
recursively drill down to the innermost subterm. The direct child visited
first in this term's dataflow should be returned.
- Specified by:
firstChild in interface Term- Overrides:
firstChild in class Lit_c
acceptCFG
public java.util.List acceptCFG(CFGBuilder v,
java.util.List succs)
- Description copied from class:
Term_c
- Visit this term in evaluation order.
- Specified by:
acceptCFG in interface Term- Overrides:
acceptCFG in class Lit_c
visitChildren
public Node visitChildren(NodeVisitor v)
- Description copied from interface:
NodeOps
- Visit the children of the node.
- Specified by:
visitChildren in interface NodeOps- Overrides:
visitChildren in class Node_c
- Parameters:
v - The visitor that will traverse/rewrite the AST.
- Returns:
- A new AST if a change was made, or
this.
typeCheck
public Node typeCheck(TypeChecker tc)
throws SemanticException
- Type check the expression.
- 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 expression 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.
isConstant
public boolean isConstant()
- According to the JLS 2nd Ed, sec 15.28, a class literal
is not a compile time constant.
- Specified by:
isConstant in interface Expr- Overrides:
isConstant in class Lit_c
constantValue
public java.lang.Object constantValue()
- Description copied from interface:
Expr
- Returns the constant value of the expression, if any.
- Specified by:
constantValue in interface Expr- Specified by:
constantValue in class Lit_c
copy
public Node copy(NodeFactory nf)
- Description copied from interface:
NodeOps
- Produce a copy of this node using the given NodeFactory.
- Specified by:
copy in interface NodeOps- Overrides:
copy in class Node_c