diff options
Diffstat (limited to 'st/MethodInstance.java')
-rw-r--r-- | st/MethodInstance.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/st/MethodInstance.java b/st/MethodInstance.java index 6cf6ccc..c2f978b 100644 --- a/st/MethodInstance.java +++ b/st/MethodInstance.java @@ -5,15 +5,24 @@ import java.util.ArrayList; public class MethodInstance extends AbstractInstance { private ArrayList<TypeInstance> args; // the list of arguments private ArrayList<TypeInstance> lvars; // the list of local variables + protected ClassInstance par_cls; // the surrounding class private TypeEnum rtrn; // the returned type - public MethodInstance(String name, TypeEnum rtrn) { + public MethodInstance(String name, TypeEnum rtrn, ClassInstance par_cls) { super(name, TypeEnum.method); this.lvars = new ArrayList<>(); this.args = new ArrayList<>(); + this.par_cls = par_cls; this.rtrn = rtrn; } + public boolean equals(Object other) { + MethodInstance o; + return (other instanceof MethodInstance && + ((o = (MethodInstance) other).getName() == this.getName() && + o.getParentClass() == this.getParentClass())); + } + public ArrayList<TypeInstance> getArguments() { return this.args; } @@ -35,4 +44,12 @@ public class MethodInstance extends AbstractInstance { this.lvars.add(lvar); } + public void addParentClass(ClassInstance par_cls) { + this.par_cls = par_cls; + } + + public ClassInstance getParentClass() { + return this.par_cls; + } + } |