jltools.ext.jl.ast
Class MethodDecl_c

java.lang.Object
  |
  +--jltools.ext.jl.ast.Node_c
        |
        +--jltools.ext.jl.ast.MethodDecl_c
All Implemented Interfaces:
ClassMember, java.lang.Cloneable, Copy, MethodDecl, Node, ProcedureDecl, java.io.Serializable
Direct Known Subclasses:
JifMethodDecl_c

public class MethodDecl_c
extends Node_c
implements MethodDecl

A method declaration.

See Also:
Serialized Form

Inner classes inherited from class jltools.ext.jl.ast.Node_c
Node_c.StringCodeWriter
 
Field Summary
protected  <>Block body
           
protected  java.util.List exceptionTypes
           
protected  Flags flags
           
protected  java.util.List formals
           
protected  MethodInstance mi
           
protected  java.lang.String name
           
protected  TypeNode returnType
           
 
Fields inherited from class jltools.ext.jl.ast.Node_c
ext, position
 
Constructor Summary
MethodDecl_c(Ext ext, Position pos, Flags flags, TypeNode returnType, java.lang.String name, java.util.List formals, java.util.List exceptionTypes, <>Block body)
           
 
Method Summary
 <>Block body()
          Get the body of the method.
 MethodDecl body(<>Block body)
          Set the body of the method.
 Node buildTypesOverride_(TypeBuilder tb)
          Build type objects for the method.
 void dump(CodeWriter w)
          Dump the AST node for debugging purposes.
 void enterScope(Context c)
          Adjust the environment on entering the scope of the method.
 Node exceptionCheck_(ExceptionChecker ec)
          Check exceptions thrown by the method.
 java.util.List exceptionTypes()
          Get the exception types of the method.
 MethodDecl exceptionTypes(java.util.List exceptionTypes)
          Set the exception types of the method.
 Flags flags()
          Get the flags of the method.
 MethodDecl flags(Flags flags)
          Set the flags of the method.
 java.util.List formals()
          Get the formals of the method.
 MethodDecl formals(java.util.List formals)
          Set the formals of the method.
 void leaveScope(Context c)
          Adjust the environment on leaving the scope of the method.
protected  MethodInstance makeMethodInstance(ClassType ct, TypeSystem ts)
           
 MethodInstance methodInstance()
          Get the method instance of the method.
 MethodDecl methodInstance(MethodInstance mi)
          Set the method instance of the method.
 java.lang.String name()
          Get the name of the method.
 MethodDecl name(java.lang.String name)
          Set the name of the method.
 ProcedureInstance procedureInstance()
          Get the procedure instance of the method.
protected  MethodDecl_c reconstruct(TypeNode returnType, java.util.List formals, java.util.List exceptionTypes, <>Block body)
          Reconstruct the method.
 Node reconstructTypes_(NodeFactory nf, TypeSystem ts, Context c)
          Reconstruct the type objects for the method.
 TypeNode returnType()
          Get the return type of the method.
 MethodDecl returnType(TypeNode returnType)
          Set the return type of the method.
 java.lang.String toString()
           
 void translate_(CodeWriter w, Translator tr)
          Write the method to an output file.
 Node typeCheck_(TypeChecker tc)
          Type check the method.
 Node visitChildren(NodeVisitor v)
          Visit the children of the method.
 
Methods inherited from class jltools.ext.jl.ast.Node_c
buildTypes_, buildTypes, buildTypesOverride, copy, disambiguate_, disambiguate, disambiguateOverride_, disambiguateOverride, disambiguateTypes_, disambiguateTypes, disambiguateTypesOverride_, disambiguateTypesOverride, exceptionCheck, exceptionCheckOverride_, exceptionCheckOverride, ext, ext, foldConstants_, foldConstants, foldConstantsOverride_, foldConstantsOverride, position, position, reconstructTypes, translate, translateBlock, translateSubstmt, typeCheck, typeCheckOverride_, typeCheckOverride, visit, visitList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jltools.ast.MethodDecl
body
 
Methods inherited from interface jltools.ast.Node
buildTypes_, copy, disambiguate_, disambiguateOverride_, disambiguateTypes_, disambiguateTypesOverride_, exceptionCheckOverride_, ext, ext, foldConstants_, foldConstantsOverride_, position, position, typeCheckOverride_, visit
 

Field Detail

flags

protected Flags flags

returnType

protected TypeNode returnType

name

protected java.lang.String name

formals

protected java.util.List formals

exceptionTypes

protected java.util.List exceptionTypes

body

protected <>Block body

mi

protected MethodInstance mi
Constructor Detail

MethodDecl_c

public MethodDecl_c(Ext ext,
                    Position pos,
                    Flags flags,
                    TypeNode returnType,
                    java.lang.String name,
                    java.util.List formals,
                    java.util.List exceptionTypes,
                    <>Block body)
Method Detail

flags

public Flags flags()
Get the flags of the method.
Specified by:
flags in interface MethodDecl

flags

public MethodDecl flags(Flags flags)
Set the flags of the method.
Specified by:
flags in interface MethodDecl

returnType

public TypeNode returnType()
Get the return type of the method.
Specified by:
returnType in interface MethodDecl

returnType

public MethodDecl returnType(TypeNode returnType)
Set the return type of the method.
Specified by:
returnType in interface MethodDecl

name

public java.lang.String name()
Get the name of the method.
Specified by:
name in interface MethodDecl

name

public MethodDecl name(java.lang.String name)
Set the name of the method.
Specified by:
name in interface MethodDecl

formals

public java.util.List formals()
Get the formals of the method.
Specified by:
formals in interface MethodDecl

formals

public MethodDecl formals(java.util.List formals)
Set the formals of the method.
Specified by:
formals in interface MethodDecl

exceptionTypes

public java.util.List exceptionTypes()
Get the exception types of the method.
Specified by:
exceptionTypes in interface MethodDecl

exceptionTypes

public MethodDecl exceptionTypes(java.util.List exceptionTypes)
Set the exception types of the method.
Specified by:
exceptionTypes in interface MethodDecl

body

public <>Block body()
Get the body of the method.
Specified by:
body in interface MethodDecl

body

public MethodDecl body(<>Block body)
Set the body of the method.

methodInstance

public MethodInstance methodInstance()
Get the method instance of the method.
Specified by:
methodInstance in interface MethodDecl

methodInstance

public MethodDecl methodInstance(MethodInstance mi)
Set the method instance of the method.
Specified by:
methodInstance in interface MethodDecl

procedureInstance

public ProcedureInstance procedureInstance()
Get the procedure instance of the method.
Specified by:
procedureInstance in interface ProcedureDecl

reconstruct

protected MethodDecl_c reconstruct(TypeNode returnType,
                                   java.util.List formals,
                                   java.util.List exceptionTypes,
                                   <>Block body)
Reconstruct the method.

visitChildren

public Node visitChildren(NodeVisitor v)
Visit the children of the method.
Specified by:
visitChildren in interface Node
Overrides:
visitChildren in class Node_c

buildTypesOverride_

public Node buildTypesOverride_(TypeBuilder tb)
                         throws SemanticException
Build type objects for the method.
Specified by:
buildTypesOverride_ in interface Node
Overrides:
buildTypesOverride_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
cb - The visitor which adds new type objects to the TypeSystem.

enterScope

public void enterScope(Context c)
Description copied from interface: Node
Adjust the environment on entering the scope of the method.
Specified by:
enterScope in interface Node
Overrides:
enterScope in class Node_c

leaveScope

public void leaveScope(Context c)
Description copied from interface: Node
Adjust the environment on leaving the scope of the method.
Specified by:
leaveScope in interface Node
Overrides:
leaveScope in class Node_c

typeCheck_

public Node typeCheck_(TypeChecker tc)
                throws SemanticException
Type check the method.
Specified by:
typeCheck_ in interface Node
Overrides:
typeCheck_ in class Node_c

exceptionCheck_

public Node exceptionCheck_(ExceptionChecker ec)
                     throws SemanticException
Check exceptions thrown by the method.
Specified by:
exceptionCheck_ in interface Node
Overrides:
exceptionCheck_ in class Node_c

toString

public java.lang.String toString()
Overrides:
toString in class Node_c

translate_

public void translate_(CodeWriter w,
                       Translator tr)
Write the method to an output file.
Specified by:
translate_ in interface Node
Overrides:
translate_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
w - The code writer to which to write.
tr - The translation pass. This is not a visitor.

dump

public void dump(CodeWriter w)
Description copied from interface: Node
Dump the AST node for debugging purposes.
Specified by:
dump in interface Node
Overrides:
dump in class Node_c

reconstructTypes_

public Node reconstructTypes_(NodeFactory nf,
                              TypeSystem ts,
                              Context c)
                       throws SemanticException
Reconstruct the type objects for the method.
Specified by:
reconstructTypes_ in interface Node
Overrides:
reconstructTypes_ in class Node_c

makeMethodInstance

protected MethodInstance makeMethodInstance(ClassType ct,
                                            TypeSystem ts)
                                     throws SemanticException