Class ThisExpr
- java.lang.Object
-
- com.tonic.analysis.source.ast.expr.ThisExpr
-
- All Implemented Interfaces:
ASTNode,Expression
public final class ThisExpr extends Object implements Expression
A reference to the enclosing instance - the 'this' expression.
-
-
Constructor Summary
Constructors Constructor Description ThisExpr(SourceType type)Creates a this expression at an unknown source location.ThisExpr(SourceType type, SourceLocation location)Creates a this expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Taccept(SourceVisitor<T> visitor)Accepts a visitor for this node.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
-
ThisExpr
public ThisExpr(SourceType type, SourceLocation location)
Creates a this expression.- Parameters:
type- the enclosing instance typelocation- the source location; defaults to UNKNOWN when null- Throws:
NullPointerException- if type is null
-
ThisExpr
public ThisExpr(SourceType type)
Creates a this expression at an unknown source location.- Parameters:
type- the enclosing instance type- Throws:
NullPointerException- if type is null
-
-
Method Detail
-
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.
-
-