Class ClassLit_c

  extended by polyglot.ext.jl.ast.Node_c
      extended by polyglot.ext.jl.ast.Term_c
          extended by polyglot.ext.jl.ast.Expr_c
              extended by polyglot.ext.jl.ast.Lit_c
                  extended by polyglot.ext.jl.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.

Field Summary
protected  TypeNode typeNode
Fields inherited from class polyglot.ext.jl.ast.Expr_c
Fields inherited from class polyglot.ext.jl.ast.Term_c
exceptions, reachable
Fields inherited from class polyglot.ext.jl.ast.Node_c
del, ext, position
Constructor Summary
ClassLit_c(Position pos, TypeNode typeNode)
Method Summary
 java.lang.Object constantValue()
          Returns the constant value of the expression, if any.
 boolean isConstant()
          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)
          Write the expression to an output file.
 java.lang.String toString()
 Node typeCheck(TypeChecker tc)
          Type check the expression.
 TypeNode typeNode()
 ClassLit typeNode(TypeNode typeNode)
 Node visitChildren(NodeVisitor v)
          Visit the children of the node.
Methods inherited from class polyglot.ext.jl.ast.Lit_c
acceptCFG, entry, precedence
Methods inherited from class polyglot.ext.jl.ast.Expr_c
booleanValue, buildTypes, byteValue, charValue, doubleValue, dump, floatValue, intValue, longValue, printSubExpr, printSubExpr, shortValue, stringValue, type, type
Methods inherited from class polyglot.ext.jl.ast.Term_c
exceptionCheck, exceptions, exceptions, listEntry, reachable, reachable
Methods inherited from class polyglot.ext.jl.ast.Node_c
addDecls, addMembers, addMembersEnter, addMembersOverride, buildTypesEnter, buildTypesOverride, childExpectedType, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, enterScope, enterScope, exceptionCheckEnter, exceptionCheckOverride, ext, ext, ext, ext, init, node, position, position, 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.Expr
precedence, printSubExpr, printSubExpr, type
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, buildTypes, buildTypesEnter, disambiguate, disambiguateEnter, enterScope, enterScope, exceptionCheck, exceptionCheckEnter, throwTypes, translate, typeCheckEnter
Methods inherited from interface polyglot.util.Copy
Methods inherited from interface polyglot.ast.Typed
Methods inherited from interface polyglot.ast.Term
acceptCFG, entry, exceptions, exceptions, reachable, reachable

Field Detail


protected TypeNode typeNode
Constructor Detail


public ClassLit_c(Position pos,
                  TypeNode typeNode)
Method Detail


public TypeNode typeNode()
Specified by:
typeNode in interface ClassLit


public ClassLit typeNode(TypeNode typeNode)


public java.lang.Object objValue()
Cannot return the correct object (except for maybe some of the primitive arrays), so we just return null here.


public Node visitChildren(NodeVisitor v)
Description copied from interface: NodeOps
Visit the children of the node.

Specified by:
visitChildren in interface NodeOps
visitChildren in class Node_c
v - The visitor that will traverse/rewrite the AST.
A new AST if a change was made, or this.


public Node typeCheck(TypeChecker tc)
               throws SemanticException
Type check the expression.

Specified by:
typeCheck in interface NodeOps
typeCheck in class Node_c
tc - The type checking visitor.


public java.lang.String toString()
toString in class Node_c


public void prettyPrint(CodeWriter w,
                        PrettyPrinter tr)
Write the expression to an output file.

Specified by:
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()
According to the JLS 2nd Ed, sec 15.28, a class literal is not a compile time constant.

Specified by:
isConstant in interface Expr
isConstant in class Lit_c


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