summaryrefslogtreecommitdiff
path: root/Homework/cs5300/p4-formatter/submit/ast/Param.java
blob: 2afa3d647af1b9826f495c7b1982bd4c94e92d7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package submit.ast;

public class Param implements Declaration {
    private final VarType type;
    private final String id;
    private final Boolean isArray;

    public Param(VarType type, String id, Boolean isArray) {
        this.type = type;
        this.id = id;
        this.isArray = isArray;
    }

    @Override
    public void toCminus(StringBuilder builder, final String prefix) {
        builder.append(prefix);
        builder.append(type).append(" ").append(id);
        if (this.isArray) {
            builder.append("[]");
        }
    }
}