public abstract class ProcedureDecl_c extends Term_c implements ProcedureDecl, ProcedureDeclOps
ProcedureDecl
is an immutable representation of a
constructor or method declaration as part of a class body.Term.Instance
Modifier and Type | Field and Description |
---|---|
protected Block |
body |
protected Flags |
flags |
protected java.util.List<Formal> |
formals |
protected Id |
name |
protected java.util.List<TypeNode> |
throwTypes |
exceptions, reachable
Constructor and Description |
---|
ProcedureDecl_c(Position pos,
Flags flags,
Id name,
java.util.List<Formal> formals,
java.util.List<TypeNode> throwTypes,
Block body)
Deprecated.
|
ProcedureDecl_c(Position pos,
Flags flags,
Id name,
java.util.List<Formal> formals,
java.util.List<TypeNode> throwTypes,
Block body,
Ext ext) |
Modifier and Type | Method and Description |
---|---|
Block |
body()
The body of the method, constructor, or initializer.
|
CodeBlock |
body(Block body)
Set the body of the method, constructor, or initializer.
|
protected <N extends ProcedureDecl_c> |
body(N n,
Block body) |
NodeVisitor |
buildTypesEnter(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node
and constructs type objects for these.
|
Term |
codeBody()
The body of the method, constructor, initializer, or field initializer.
|
CodeInstance |
codeInstance()
The CodeInstance of the method, constructor, or initializer.
|
Node |
disambiguate(AmbiguityRemover ar)
Remove any remaining ambiguities from the AST.
|
void |
dump(CodeWriter w)
Dump the AST node for debugging purposes.
|
NodeVisitor |
exceptionCheckEnter(ExceptionChecker ec)
Check that exceptions are properly propagated throughout the AST.
|
Flags |
flags()
The procedure's flags.
|
ProcedureDecl |
flags(Flags flags)
Set the procedure's flags.
|
protected <N extends ProcedureDecl_c> |
flags(N n,
Flags flags) |
java.util.List<Formal> |
formals()
The procedure's formal parameters.
|
ProcedureDecl |
formals(java.util.List<Formal> formals)
Set the procedure's formal parameters.
|
protected <N extends ProcedureDecl_c> |
formals(N n,
java.util.List<Formal> formals) |
Id |
id()
The procedure's name.
|
ProcedureDecl |
id(Id name)
Set the procedure's name.
|
protected <N extends ProcedureDecl_c> |
id(N n,
Id name) |
java.lang.String |
name()
The procedure's name.
|
ProcedureDecl |
name(java.lang.String name)
Set the procedure's name.
|
void |
prettyPrint(CodeWriter w,
PrettyPrinter tr)
Pretty-print the AST using the given
CodeWriter . |
abstract ProcedureInstance |
procedureInstance()
The procedure's type object.
|
protected <N extends ProcedureDecl_c> |
reconstruct(N n,
Id name,
java.util.List<Formal> formals,
java.util.List<TypeNode> throwTypes,
Block body)
Reconstruct the procedure.
|
java.util.List<TypeNode> |
throwTypes()
The procedure's exception throw types.
|
ProcedureDecl |
throwTypes(java.util.List<TypeNode> throwTypes)
Set the procedure's exception throw types.
|
protected <N extends ProcedureDecl_c> |
throwTypes(N n,
java.util.List<TypeNode> throwTypes) |
acceptCFG, exceptionCheck, exceptions, exceptions, exceptions, extRewrite, firstChild, listChild, reachable, reachable, reachable
addDecls, buildTypes, checkConstants, childExpectedType, copy, copy, copy, copyIfNeeded, del, del, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, error, error, error, ext, ext, ext, ext, extRewriteEnter, isDisambiguated, isTypeChecked, lang, position, position, position, prettyPrint, prettyPrint, prettyPrint, prettyPrint, print, printBlock, printSubStmt, throwTypes, toString, translate, typeCheck, typeCheckEnter, typeCheckOverride, visit, visitChild, visitChildren, visitEdge, visitList
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
exceptions, exceptions, reachable, reachable
del, del, error, error, ext, ext, ext, ext, isDisambiguated, isTypeChecked, position, position, visit, visitEdge
addDecls, buildTypes, checkConstants, childExpectedType, copy, copy, disambiguateEnter, disambiguateOverride, dump, dump, dump, dump, enterChildScope, enterScope, exceptionCheck, extRewrite, extRewriteEnter, lang, prettyPrint, prettyPrint, prettyPrint, prettyPrint, throwTypes, translate, typeCheck, typeCheckEnter, typeCheckOverride, visitChild, visitChildren, visitList
memberInstance
prettyPrintHeader
protected Flags flags
protected Id name
protected java.util.List<Formal> formals
protected java.util.List<TypeNode> throwTypes
protected Block body
@Deprecated public ProcedureDecl_c(Position pos, Flags flags, Id name, java.util.List<Formal> formals, java.util.List<TypeNode> throwTypes, Block body)
public Flags flags()
ProcedureDecl
flags
in interface ProcedureDecl
public ProcedureDecl flags(Flags flags)
ProcedureDecl
flags
in interface ProcedureDecl
protected <N extends ProcedureDecl_c> N flags(N n, Flags flags)
public Id id()
ProcedureDecl
id
in interface ProcedureDecl
public ProcedureDecl id(Id name)
ProcedureDecl
id
in interface ProcedureDecl
protected <N extends ProcedureDecl_c> N id(N n, Id name)
public java.lang.String name()
ProcedureDecl
name
in interface ProcedureDecl
public ProcedureDecl name(java.lang.String name)
ProcedureDecl
name
in interface ProcedureDecl
public java.util.List<Formal> formals()
ProcedureDecl
formals
in interface ProcedureDecl
Formal
.public ProcedureDecl formals(java.util.List<Formal> formals)
ProcedureDecl
formals
in interface ProcedureDecl
formals
- A list of Formal
.protected <N extends ProcedureDecl_c> N formals(N n, java.util.List<Formal> formals)
public java.util.List<TypeNode> throwTypes()
ProcedureDecl
throwTypes
in interface ProcedureDecl
TypeNode
.public ProcedureDecl throwTypes(java.util.List<TypeNode> throwTypes)
ProcedureDecl
throwTypes
in interface ProcedureDecl
throwTypes
- A list of TypeNode
.protected <N extends ProcedureDecl_c> N throwTypes(N n, java.util.List<TypeNode> throwTypes)
public Term codeBody()
CodeNode
public Block body()
CodeBlock
public CodeBlock body(Block body)
CodeBlock
protected <N extends ProcedureDecl_c> N body(N n, Block body)
public CodeInstance codeInstance()
CodeNode
codeInstance
in interface CodeNode
public abstract ProcedureInstance procedureInstance()
ProcedureDecl
procedureInstance
in interface ProcedureDecl
public NodeVisitor buildTypesEnter(TypeBuilder tb) throws SemanticException
NodeOps
TypeSystem
.
This method is called by the enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.buildTypesEnter
in interface NodeOps
buildTypesEnter
in class Node_c
tb
- The visitor which adds new type objects to the
TypeSystem
.SemanticException
protected <N extends ProcedureDecl_c> N reconstruct(N n, Id name, java.util.List<Formal> formals, java.util.List<TypeNode> throwTypes, Block body)
public Node disambiguate(AmbiguityRemover ar) 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.
The node should not assume that its children have been disambiguated.
If it depends on a child being disambiguated,
it may just return this
without doing any work.disambiguate
in interface NodeOps
disambiguate
in class Node_c
ar
- The visitor which disambiguates.SemanticException
public NodeVisitor exceptionCheckEnter(ExceptionChecker ec) throws SemanticException
NodeOps
enter()
method of the
visitor. The * method should perform work that should be done
before visiting the children of the node. The method may return
this
or a new copy of the node on which
visitChildren()
and leave()
will be
invoked.exceptionCheckEnter
in interface NodeOps
exceptionCheckEnter
in class Node_c
ec
- 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.