package st; import java.util.ArrayList; public class MethodInstance extends AbstractInstance { private ArrayList args; // the list of arguments private ArrayList 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); this.lvars = new ArrayList<>(); this.args = new ArrayList<>(); this.rtrn = rtrn; } public void addArgument(TypeInstance arg) { this.args.add(arg); this.lvars.add(arg); } public void addLocal(TypeInstance lvar) { this.lvars.add(lvar); } public AbstractInstance getScope() { /** * Returns the scope of the method, or * `null' if unset. */ return this.scope; } }