summaryrefslogtreecommitdiff
path: root/src/fjbg/ch/epfl/lamp/fjbg/JLocalVariable.java
blob: af7980656f6714afac6447caae7050b70d68fc40 (plain) (blame)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* FJBG -- Fast Java Bytecode Generator
 * Copyright 2002-2013 LAMP/EPFL
 * @author  Michel Schinz
 */

package ch.epfl.lamp.fjbg;

/**
 * Representation of a local variable or method argument.
 *
 * @author Michel Schinz
 * @version 1.0
 */

public class JLocalVariable {
    protected final JMethod owner;
    protected final JType type;
    protected final String name;
    protected final int index;

    protected JLocalVariable(FJBGContext context,
                             JMethod owner,
                             JType type,
                             String name,
                             int index) {
        this.owner = owner;
        this.type = type;
        this.name = name;
        this.index = index;

        assert index < 0xFFFF : "index too big for local variable: " + index;
    }

    public JMethod getOwner() { return owner; }
    public int getIndex() { return index; }
    public String getName() { return name; }
    public JType getType() { return type; }

    /*@Override*/ public String toString() {
        return "0\t"+type.getSize()+"\t"+index+"\t"+name+"\t"+type;
    }
}