Class ClassExpr
- java.lang.Object
-
- com.tonic.analysis.source.ast.expr.ClassExpr
-
- All Implemented Interfaces:
ASTNode,Expression
public final class ClassExpr extends Object implements Expression
A class literal expression: Type.class.
-
-
Constructor Summary
Constructors Constructor Description ClassExpr(SourceType classType)Creates a class literal with an unknown source location.ClassExpr(SourceType classType, SourceLocation location)Creates a class literal; its static type is java.lang.Class parameterized by the referenced type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(SourceVisitor<T> visitor)Accepts a visitor for this node.SourceTypegetClassType()SourceLocationgetLocation()Gets the source location of this node.ASTNodegetParent()Gets the parent node in the AST tree.SourceTypegetType()Gets the inferred type of this expression.voidsetParent(ASTNode parent)Sets the parent node in the AST tree.StringtoString()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tonic.analysis.source.ast.ASTNode
deepClone, findAll, findAll, findAncestor, findFirst, findFirst, getChildren, getRoot, isDescendantOf, remove, replaceWith, stream, stream, walk
-
-
-
-
Constructor Detail
-
ClassExpr
public ClassExpr(SourceType classType, SourceLocation location)
Creates a class literal; its static type is java.lang.Class parameterized by the referenced type.- Parameters:
classType- the type being referencedlocation- the source location, or null for unknown- Throws:
NullPointerException- if classType is null
-
ClassExpr
public ClassExpr(SourceType classType)
Creates a class literal with an unknown source location.- Parameters:
classType- the type being referenced- Throws:
NullPointerException- if classType is null
-
-
Method Detail
-
getClassType
public SourceType getClassType()
- Returns:
- the class type
-
getType
public SourceType getType()
Description copied from interface:ExpressionGets the inferred type of this expression.- Specified by:
getTypein interfaceExpression- Returns:
- the type
-
getLocation
public SourceLocation getLocation()
Description copied from interface:ASTNodeGets the source location of this node.- Specified by:
getLocationin interfaceASTNode- Returns:
- the location
-
getParent
public ASTNode getParent()
Description copied from interface:ASTNodeGets the parent node in the AST tree.
-
setParent
public void setParent(ASTNode parent)
Description copied from interface:ASTNodeSets the parent node in the AST tree.
-
accept
public <T> T accept(SourceVisitor<T> visitor)
Description copied from interface:ASTNodeAccepts a visitor for this node.
-
-