polyglot.ext.coffer.ast
Class CofferMethodDecl_c
java.lang.Object
polyglot.ext.jl.ast.Node_c
polyglot.ext.jl.ast.Term_c
polyglot.ext.jl.ast.MethodDecl_c
polyglot.ext.coffer.ast.CofferMethodDecl_c
- All Implemented Interfaces:
- java.lang.Cloneable, ClassMember, CodeDecl, JL, MethodDecl, Node, NodeOps, ProcedureDecl, Term, CofferMethodDecl, Copy
public class CofferMethodDecl_c
- extends MethodDecl_c
- implements CofferMethodDecl
An implementation of the CofferMethodDecl
interface.
ConstructorDecl
is extended with pre- and post-conditions.
Method Summary |
Node |
buildTypes(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node
and constructs type objects for these. |
KeySetNode |
entryKeys()
|
CofferMethodDecl |
entryKeys(KeySetNode entryKeys)
|
protected MethodInstance |
makeMethodInstance(ClassType ct,
TypeSystem ts)
|
void |
prettyPrintHeader(Flags flags,
CodeWriter w,
PrettyPrinter tr)
Write the method to an output file. |
protected CofferMethodDecl_c |
reconstruct(TypeNode returnType,
java.util.List formals,
KeySetNode entryKeys,
KeySetNode returnKeys,
java.util.List throwConstraints,
Block body)
|
KeySetNode |
returnKeys()
|
CofferMethodDecl |
returnKeys(KeySetNode returnKeys)
|
java.util.List |
throwConstraints()
|
CofferMethodDecl |
throwConstraints(java.util.List throwConstraints)
|
java.util.List |
throwTypes()
Get the exception types of the method. |
MethodDecl |
throwTypes(java.util.List l)
Set the exception types of the method. |
Node |
typeCheck(TypeChecker tc)
Type check the method. |
Node |
visitChildren(NodeVisitor v)
Visit the children of the method. |
Methods inherited from class polyglot.ext.jl.ast.MethodDecl_c |
acceptCFG, addMembersEnter, body, body, buildTypesEnter, codeInstance, disambiguate, disambiguateEnter, dump, enterScope, entry, exceptionCheck, flags, flags, formals, formals, methodInstance, methodInstance, name, name, overrideMethodCheck, prettyPrint, procedureInstance, reconstruct, returnType, returnType, toString, translate |
Methods inherited from class polyglot.ext.jl.ast.Node_c |
addDecls, addMembers, addMembersOverride, buildTypesOverride, childExpectedType, copy, del, del, disambiguateOverride, enterScope, exceptionCheckEnter, exceptionCheckOverride, ext, ext, ext, ext, init, node, position, position, print, printBlock, printSubStmt, throwTypes, 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.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, buildTypesEnter, disambiguate, disambiguateEnter, enterScope, enterScope, exceptionCheck, exceptionCheckEnter, prettyPrint, throwTypes, translate, typeCheckEnter |
Methods inherited from interface polyglot.util.Copy |
copy |
entryKeys
protected KeySetNode entryKeys
returnKeys
protected KeySetNode returnKeys
throwConstraints
protected java.util.List throwConstraints
CofferMethodDecl_c
public CofferMethodDecl_c(Position pos,
Flags flags,
TypeNode returnType,
java.lang.String name,
java.util.List formals,
KeySetNode entryKeys,
KeySetNode returnKeys,
java.util.List throwConstraints,
Block body)
entryKeys
public KeySetNode entryKeys()
- Specified by:
entryKeys
in interface CofferMethodDecl
entryKeys
public CofferMethodDecl entryKeys(KeySetNode entryKeys)
- Specified by:
entryKeys
in interface CofferMethodDecl
returnKeys
public KeySetNode returnKeys()
- Specified by:
returnKeys
in interface CofferMethodDecl
returnKeys
public CofferMethodDecl returnKeys(KeySetNode returnKeys)
- Specified by:
returnKeys
in interface CofferMethodDecl
throwTypes
public java.util.List throwTypes()
- Description copied from class:
MethodDecl_c
- Get the exception types of the method.
- Specified by:
throwTypes
in interface MethodDecl
- Specified by:
throwTypes
in interface ProcedureDecl
- Overrides:
throwTypes
in class MethodDecl_c
- Returns:
- A list of
TypeNode
.
throwTypes
public MethodDecl throwTypes(java.util.List l)
- Description copied from class:
MethodDecl_c
- Set the exception types of the method.
- Specified by:
throwTypes
in interface MethodDecl
- Overrides:
throwTypes
in class MethodDecl_c
- Parameters:
l
- A list of TypeNode
.
throwConstraints
public java.util.List throwConstraints()
- Specified by:
throwConstraints
in interface CofferMethodDecl
throwConstraints
public CofferMethodDecl throwConstraints(java.util.List throwConstraints)
- Specified by:
throwConstraints
in interface CofferMethodDecl
reconstruct
protected CofferMethodDecl_c reconstruct(TypeNode returnType,
java.util.List formals,
KeySetNode entryKeys,
KeySetNode returnKeys,
java.util.List throwConstraints,
Block body)
visitChildren
public Node visitChildren(NodeVisitor v)
- Description copied from class:
MethodDecl_c
- Visit the children of the method.
- Specified by:
visitChildren
in interface NodeOps
- Overrides:
visitChildren
in class MethodDecl_c
- Parameters:
v
- The visitor that will traverse/rewrite the AST.
- Returns:
- A new AST if a change was made, or
this
.
buildTypes
public Node buildTypes(TypeBuilder tb)
throws SemanticException
- Description copied from interface:
NodeOps
- Collects classes, methods, and fields from the AST rooted at this node
and constructs type objects for these. These type objects may be
ambiguous. Inserts classes into the
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.
- Specified by:
buildTypes
in interface NodeOps
- Overrides:
buildTypes
in class MethodDecl_c
- Parameters:
tb
- The visitor which adds new type objects to the
TypeSystem
.
- Throws:
SemanticException
typeCheck
public Node typeCheck(TypeChecker tc)
throws SemanticException
- Description copied from class:
MethodDecl_c
- Type check the method.
- Specified by:
typeCheck
in interface NodeOps
- Overrides:
typeCheck
in class MethodDecl_c
- Parameters:
tc
- The type checking visitor.
- Throws:
SemanticException
makeMethodInstance
protected MethodInstance makeMethodInstance(ClassType ct,
TypeSystem ts)
throws SemanticException
- Overrides:
makeMethodInstance
in class MethodDecl_c
- Throws:
SemanticException
prettyPrintHeader
public void prettyPrintHeader(Flags flags,
CodeWriter w,
PrettyPrinter tr)
- Write the method to an output file.
- Overrides:
prettyPrintHeader
in class MethodDecl_c