summaryrefslogtreecommitdiff
path: root/st/MethodInstance.java
diff options
context:
space:
mode:
Diffstat (limited to 'st/MethodInstance.java')
-rw-r--r--st/MethodInstance.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/st/MethodInstance.java b/st/MethodInstance.java
index 8b4ed57..d6c22b6 100644
--- a/st/MethodInstance.java
+++ b/st/MethodInstance.java
@@ -3,9 +3,10 @@ package st;
import java.util.ArrayList;
public class MethodInstance extends AbstractInstance {
- private ArrayList<String> args; // the list of arguments
- private ArrayList<String> lvars; // the list of local variables
+ private ArrayList<TypeInstance> args; // the list of arguments
+ private ArrayList<TypeInstance> lvars; // the list of local variables
private TypeEnum rtrn; // the returned type
+ private ClassInstance scope; // the surrounding class
public MethodInstance(String name, TypeEnum rtrn) {
super(name, TypeEnum.method);
@@ -14,18 +15,21 @@ public class MethodInstance extends AbstractInstance {
this.rtrn = rtrn;
}
- public String toString() {
- return name + ":T[" + type + "]R[" +
- this.rtrn + "]P[" + this.args.toString() +
- "]V[" + this.lvars.toString() + "]";
+ public void addArgument(TypeInstance arg) {
+ this.args.add(arg);
+ this.lvars.add(arg);
}
- public void set_args(ArrayList<String> args) {
- this.args = args;
+ public void addLocal(TypeInstance lvar) {
+ this.lvars.add(lvar);
}
- public void set_locals(ArrayList<String> lvars) {
- this.lvars = lvars;
+ public AbstractInstance getScope() {
+ /**
+ * Returns the scope of the method, or
+ * `null' if unset.
+ */
+ return this.scope;
}
}