|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.util.Utils
at.dms.compiler.Phylum
at.dms.kjc.JPhylum
at.dms.kjc.JMemberDeclaration
at.dms.kjc.JMethodDeclaration
public class JMethodDeclaration
This class represents a Java method declaration in the syntax tree.
Field Summary | |
---|---|
protected JBlock |
body
|
protected CClassType[] |
exceptions
|
protected String |
ident
|
protected int |
modifiers
|
protected JFormalParameter[] |
parameters
|
protected CType |
returnType
|
Fields inherited from class at.dms.util.Utils |
---|
EMPTY_LIST, getForLoopCallers |
Fields inherited from interface at.dms.kjc.Constants |
---|
CMP_VERSION, JAV_CLASS, JAV_CLONE, JAV_CLONEABLE, JAV_CONSTRUCTOR, JAV_ERROR, JAV_EXCEPTION, JAV_INIT, JAV_LENGTH, JAV_NAME_SEPARATOR, JAV_OBJECT, JAV_OUTER_THIS, JAV_RUNTIME, JAV_RUNTIME_EXCEPTION, JAV_STATIC_INIT, JAV_STRING, JAV_STRINGBUFFER, JAV_THIS, JAV_THROWABLE, OPE_BAND, OPE_BNOT, OPE_BOR, OPE_BSR, OPE_BXOR, OPE_EQ, OPE_GE, OPE_GT, OPE_LE, OPE_LNOT, OPE_LT, OPE_MINUS, OPE_NE, OPE_PERCENT, OPE_PLUS, OPE_POSTDEC, OPE_POSTINC, OPE_PREDEC, OPE_PREINC, OPE_SIMPLE, OPE_SL, OPE_SLASH, OPE_SR, OPE_STAR, TID_ARRAY, TID_BIT, TID_BOOLEAN, TID_BYTE, TID_CHAR, TID_CLASS, TID_DOUBLE, TID_FLOAT, TID_INT, TID_LONG, TID_SHORT, TID_VECTOR, TID_VOID, VECTOR_EMPTY |
Constructor Summary | |
---|---|
protected |
JMethodDeclaration()
|
|
JMethodDeclaration(CType returnType,
String ident,
JFormalParameter[] parameters,
JBlock body)
|
|
JMethodDeclaration(String comment)
Dummy JMethodDeclarations should now include comment... |
|
JMethodDeclaration(TokenReference where,
int modifiers,
CType returnType,
String ident,
JFormalParameter[] parameters,
CClassType[] exceptions,
JBlock body,
JavadocComment javadoc,
JavaStyleComment[] comments)
Constructs a method declaration node in the syntax tree. |
Method Summary | |
---|---|
Object |
accept(AttributeVisitor p)
Accepts the specified attribute visitor |
void |
accept(KjcVisitor p)
Accepts the specified visitor |
void |
addAllStatements(int pos,
List lst)
Adds all statements in |
void |
addAllStatements(List lst)
Adds all statements in |
void |
addParameter(JFormalParameter param)
Inserts |
void |
addStatement(JStatement statement)
Adds |
void |
addStatementFirst(JStatement statement)
Adds |
void |
checkBody1(CClassContext context)
Check expression and evaluate and alter context |
CSourceMethod |
checkInterface(CClassContext context)
Second pass (quick), check interface looks good Exceptions are not allowed here, this pass is just a tuning pass in order to create informations about exported elements such as Classes, Interfaces, Methods, Constructors and Fields |
Object |
deepClone()
Returns a deep clone of this object. |
protected void |
deepCloneInto(JMethodDeclaration other)
Clones all fields of this into |
boolean |
doesIO()
Returns whether this has a non-zero push, pop, or peek rate. |
static JMethodDeclaration[] |
EMPTY()
|
void |
genCode(CodeSequence code)
Generates a sequence of bytescodes |
JBlock |
getBody()
Returns the body of this. |
String |
getName()
Return identifier of this method. |
JFormalParameter[] |
getParameters()
Gets parameters of this. |
JExpression |
getPeek()
|
int |
getPeekInt()
Returns how many items are peeked. |
String |
getPeekString()
Returns string representation of peek rate (either in literal or range, like [1,2,3]). |
JExpression |
getPop()
|
int |
getPopInt()
Returns how many items are popped. |
String |
getPopString()
Returns string representation of pop rate (either in literal or range, like [1,2,3]). |
JExpression |
getPush()
|
int |
getPushInt()
Returns how many items are pushed.This will throw an exception if the integral numbers haven't been calculated yet--in this case one can only get the JExpression, but calling getPush. |
String |
getPushString()
Returns string representation of push rate (either in literal or range, like [1,2,3]). |
CType |
getReturnType()
Return ctype return type of this method. |
ListIterator |
getStatementIterator()
Returns iterator of statements in this. |
List |
getStatements()
Returns list of statements in this. |
void |
setBody(JBlock body)
Sets the body of this |
void |
setName(String str)
Set method name to |
void |
setParameters(JFormalParameter[] param)
|
void |
setPeek(int p)
|
void |
setPeek(JExpression p)
|
void |
setPop(int p)
|
void |
setPop(JExpression p)
|
void |
setPush(int p)
|
void |
setPush(JExpression p)
|
String |
toString()
|
Methods inherited from class at.dms.kjc.JMemberDeclaration |
---|
deepCloneInto, genComments, genComments1, getCClass, getField, getMethod, isDeprecated, setInterface |
Methods inherited from class at.dms.kjc.JPhylum |
---|
assertMutable, check, check, check, check, deepCloneInto, fail, setLineNumber |
Methods inherited from class at.dms.compiler.Phylum |
---|
deepCloneInto, getTokenReference, setTokenReference |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int modifiers
protected CType returnType
protected String ident
protected JFormalParameter[] parameters
protected CClassType[] exceptions
protected JBlock body
Constructor Detail |
---|
protected JMethodDeclaration()
public JMethodDeclaration(String comment)
comment
- is for use in debugging Since this comment
is often lost in making copies, it is included
in C / C++ comment form in the ident.public JMethodDeclaration(TokenReference where, int modifiers, CType returnType, String ident, JFormalParameter[] parameters, CClassType[] exceptions, JBlock body, JavadocComment javadoc, JavaStyleComment[] comments)
where
- the line of this node in the source codemodifiers
- the list of modifiers of the methodreturnType
- the return type of the methodident
- the name of the methodparameters
- the parameters of the methodexceptions
- the exceptions declared by the methodbody
- the body of the methodjavadoc
- java documentation commentscomments
- other comments in the source codepublic JMethodDeclaration(CType returnType, String ident, JFormalParameter[] parameters, JBlock body)
Method Detail |
---|
public void setName(String str)
name
public String getName()
public CType getReturnType()
public void addParameter(JFormalParameter param)
paramas the first parameter of this.
public void addStatement(JStatement statement)
statementto the end of the statements in this.
public void addStatementFirst(JStatement statement)
statementto the end of the statements in this.
public void addAllStatements(int pos, List lst)
lstto this, at the specified position.
public void addAllStatements(List lst)
lstto end of this.
public boolean doesIO()
public void setPeek(JExpression p)
public void setPop(JExpression p)
public void setPush(JExpression p)
public void setPeek(int p)
public void setPop(int p)
public void setPush(int p)
public JExpression getPeek()
public JExpression getPop()
public JExpression getPush()
public int getPopInt()
public int getPeekInt()
public int getPushInt()
public String getPopString()
public String getPeekString()
public String getPushString()
public CSourceMethod checkInterface(CClassContext context) throws PositionedError
PositionedError
- an error with reference to the source filepublic void checkBody1(CClassContext context) throws PositionedError
context
- the actual context of analyse
PositionedError
- Error catched as soon as possiblepublic void accept(KjcVisitor p)
accept
in class JMemberDeclaration
p
- the visitorpublic Object accept(AttributeVisitor p)
accept
in class JMemberDeclaration
p
- the visitorpublic void genCode(CodeSequence code)
code
- the code listpublic ListIterator getStatementIterator()
public JBlock getBody()
public void setBody(JBlock body)
public List getStatements()
public JFormalParameter[] getParameters()
public void setParameters(JFormalParameter[] param)
public static JMethodDeclaration[] EMPTY()
public String toString()
toString
in class Object
public Object deepClone()
deepClone
in interface DeepCloneable
deepClone
in class JMemberDeclaration
protected void deepCloneInto(JMethodDeclaration other)
other
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |