a7df786655a68ce757c1c50c0b1b8051f9698c5e
[IRC.git] / Robust / src / IR / MethodDescriptor.java
1 package IR;
2 import IR.Tree.Modifiers;
3 import IR.Tree.ExpressionNode;
4 import java.util.Vector;
5
6 /**
7  * Descriptor 
8  *
9  * represents a symbol in the language (var name, function name, etc).
10  */
11
12 public class MethodDescriptor extends Descriptor {
13
14     protected Modifiers modifier;
15     protected TypeDescriptor returntype;
16     protected String identifier;
17     protected Vector param_name;
18     protected Vector param_type;
19     
20     public MethodDescriptor(Modifiers m, TypeDescriptor rt, String identifier) {
21         super(identifier);
22         this.modifier=m;
23         this.returntype=rt;
24         this.identifier=identifier;
25         this.safename = "__" + name + "__";
26         this.uniqueid=count++;
27         param_name=new Vector();
28         param_type=new Vector();
29     }
30     public void addParameter(TypeDescriptor type, String paramname) {
31         param_name.add(paramname);
32         param_type.add(type);
33     }
34
35     public String toString() {
36         String st=modifier.toString()+returntype.toString()+" "+identifier+"(";
37         for(int i=0;i<param_type.size();i++) {
38             st+=param_type.get(i).toString()+" "+param_name.get(i).toString();
39             if ((i+1)!=param_type.size())
40                 st+=", ";
41         }
42         st+=")";
43         return st;
44     }
45 }