summaryrefslogtreecommitdiff
path: root/st/MethodInstance.java
blob: 25096d2acbab122db1d148d7bfdfb3c91c3b8577 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package st;

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
    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);
    }

}