public class ConstructorCall_c extends Stmt_c implements ConstructorCall, ProcedureCallOps
ConstructorCall
represents a direct call to a constructor.
For instance, super(...)
or this(...)
.ConstructorCall.Kind
Term.Instance
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Expr> |
arguments |
protected ConstructorInstance |
ci |
protected ConstructorCall.Kind |
kind |
protected Expr |
qualifier |
exceptions, reachable
SUPER, THIS
Constructor and Description |
---|
ConstructorCall_c(Position pos,
ConstructorCall.Kind kind,
Expr qualifier,
java.util.List<? extends Expr> arguments) |
ConstructorCall_c(Position pos,
ConstructorCall.Kind kind,
Expr qualifier,
java.util.List<? extends Expr> arguments,
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.util.List<Expr> |
arguments()
The call's actual arguments.
|
ProcedureCall |
arguments(java.util.List<Expr> arguments)
Set the call's actual arguments.
|
protected <N extends ConstructorCall_c> |
arguments(N n,
java.util.List<Expr> arguments) |
Node |
buildTypes(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node
and constructs type objects for these.
|
Type |
childExpectedType(Expr child,
AscriptionVisitor av)
Get the expected type of a child expression of
this . |
ConstructorInstance |
constructorInstance()
The type object of the constructor to call.
|
ConstructorCall |
constructorInstance(ConstructorInstance ci)
Set the type object of the constructor to call.
|
protected <N extends ConstructorCall_c> |
constructorInstance(N n,
ConstructorInstance ci) |
Node |
copy(NodeFactory nf)
Produce a copy of this node using the given NodeFactory.
|
Context |
enterScope(Context c)
An explicit constructor call is a static context.
|
Node |
extRewrite(ExtensionRewriter rw)
Rewrite the AST for the compilation in this language.
|
Term |
firstChild()
Return the first direct subterm performed when evaluating this term.
|
ConstructorCall.Kind |
kind()
The kind of the call: THIS or SUPER.
|
ConstructorCall |
kind(ConstructorCall.Kind kind)
Set the kind of the call: THIS or SUPER.
|
protected <N extends ConstructorCall_c> |
kind(N n,
ConstructorCall.Kind kind) |
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given
CodeWriter . |
void |
printArgs(CodeWriter w,
PrettyPrinter tr) |
protected void |
printSubExpr(Expr expr,
CodeWriter w,
PrettyPrinter pp) |
ProcedureInstance |
procedureInstance()
The type object of the procedure we are calling.
|
Expr |
qualifier()
The qualifier of the call, possibly null.
|
ConstructorCall |
qualifier(Expr qualifier)
Set the qualifier of the call, possibly null.
|
protected <N extends ConstructorCall_c> |
qualifier(N n,
Expr qualifier) |
protected <N extends ConstructorCall_c> |
reconstruct(N n,
Expr qualifier,
java.util.List<Expr> arguments)
Reconstruct the constructor call.
|
java.util.List<Type> |
throwTypes(TypeSystem ts)
List of Types of exceptions that might get thrown.
|
java.lang.String |
toString() |
Node |
typeCheck(TypeChecker tc)
Type check the AST.
|
Node |
visitChildren(NodeVisitor v)
Visit the children of the node.
|
exceptionCheck, exceptions, exceptions, exceptions, listChild, reachable, reachable, reachable
addDecls, buildTypesEnter, checkConstants, copy, copy, copyIfNeeded, del, del, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, dump, enterChildScope, error, error, error, exceptionCheckEnter, ext, ext, ext, ext, extRewriteEnter, isDisambiguated, isTypeChecked, lang, position, position, position, prettyPrint, prettyPrint, prettyPrint, prettyPrint, print, printBlock, printSubStmt, translate, typeCheckEnter, typeCheckOverride, visit, visitChild, visitEdge, visitList
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
exceptions, exceptions, reachable, reachable
del, del, dump, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitEdge
addDecls, buildTypesEnter, checkConstants, copy, disambiguate, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, exceptionCheck, exceptionCheckEnter, extRewriteEnter, lang, prettyPrint, prettyPrint, prettyPrint, prettyPrint, translate, typeCheckEnter, typeCheckOverride, visitChild, visitList
protected ConstructorCall.Kind kind
protected Expr qualifier
protected java.util.List<Expr> arguments
protected ConstructorInstance ci
public ConstructorCall_c(Position pos, ConstructorCall.Kind kind, Expr qualifier, java.util.List<? extends Expr> arguments)
public ConstructorCall_c(Position pos, ConstructorCall.Kind kind, Expr qualifier, java.util.List<? extends Expr> arguments, Ext ext)
public Expr qualifier()
ConstructorCall
qualifier
in interface ConstructorCall
public ConstructorCall qualifier(Expr qualifier)
ConstructorCall
qualifier
in interface ConstructorCall
protected <N extends ConstructorCall_c> N qualifier(N n, Expr qualifier)
public ConstructorCall.Kind kind()
ConstructorCall
kind
in interface ConstructorCall
public ConstructorCall kind(ConstructorCall.Kind kind)
ConstructorCall
kind
in interface ConstructorCall
protected <N extends ConstructorCall_c> N kind(N n, ConstructorCall.Kind kind)
public java.util.List<Expr> arguments()
ProcedureCall
arguments
in interface ProcedureCall
Expr
.public ProcedureCall arguments(java.util.List<Expr> arguments)
ProcedureCall
arguments
in interface ProcedureCall
arguments
- A list of Expr
.protected <N extends ConstructorCall_c> N arguments(N n, java.util.List<Expr> arguments)
public ProcedureInstance procedureInstance()
ProcedureCall
procedureInstance
in interface ProcedureCall
public ConstructorInstance constructorInstance()
ConstructorCall
constructorInstance
in interface ConstructorCall
public ConstructorCall constructorInstance(ConstructorInstance ci)
ConstructorCall
constructorInstance
in interface ConstructorCall
protected <N extends ConstructorCall_c> N constructorInstance(N n, ConstructorInstance ci)
public Context enterScope(Context c)
enterScope
in interface NodeOps
enterScope
in class Node_c
c
- the current Context
Context
to be used for visiting this node.protected <N extends ConstructorCall_c> N reconstruct(N n, Expr qualifier, java.util.List<Expr> arguments)
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 buildTypes(TypeBuilder tb) throws SemanticException
NodeOps
TypeSystem
.
This method is called by the 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.buildTypes
in interface NodeOps
buildTypes
in class Node_c
tb
- The visitor which adds new type objects to the
TypeSystem
.SemanticException
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 Type childExpectedType(Expr child, AscriptionVisitor av)
NodeOps
this
.
The expected type is determined by the context in that the child occurs
(e.g., for x = e
, the expected type of e
is
the declared type of x
.
The expected type should impose the least constraints on the child's
type that are allowed by the parent node.childExpectedType
in interface NodeOps
childExpectedType
in class Node_c
child
- A child expression of this node.av
- An ascription visitor.child
.public Node extRewrite(ExtensionRewriter rw) 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.extRewrite
in interface NodeOps
extRewrite
in class Term_c
rw
- The 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 void printArgs(CodeWriter w, PrettyPrinter tr)
printArgs
in interface ProcedureCallOps
public Term firstChild()
TermOps
firstChild
in interface TermOps
firstChild
in class Term_c
public <T> java.util.List<T> acceptCFG(CFGBuilder<?> v, java.util.List<T> succs)
TermOps
public java.util.List<Type> throwTypes(TypeSystem ts)
NodeOps
throwTypes
in interface NodeOps
throwTypes
in class Node_c
public Node copy(NodeFactory nf)
NodeOps
protected void printSubExpr(Expr expr, CodeWriter w, PrettyPrinter pp)