summaryrefslogtreecommitdiff
path: root/src/ast/nodes/ParamdefNode.java
blob: 265b6b65fb48d6a8224121ef0507f6a71f43a2b1 (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
28
29
30
31
32
33
34
package ast.nodes;

import java.util.ArrayList;

import ast.types.*;
import semanticanalysis.*;

/**
 * Node for the `paramdef` statement of the grammar. Extends the `AtomNode`
 * class.
 */
public class ParamdefNode extends AtomNode {
    public ParamdefNode(String val) {
        super(val);
    }

    @Override
    public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting) {
        ST.insert(this.getId(), this.typeCheck(), _nesting, "");

        return new ArrayList<SemanticError>();
    }

    // FIXME: it should returns the param' type
    @Override
    public Type typeCheck() {
        return new VoidType();
    }

    @Override
    public String toPrint(String prefix) {
        return prefix + "Paramdef(" + val + ")\n";
    }
}