-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunNode.java
54 lines (40 loc) · 1.23 KB
/
FunNode.java
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
43
44
45
46
47
48
49
50
51
52
53
54
package nodes;
import Visitor.*;
import leafs.LeafID;
import org.w3c.dom.Element;
import java.util.ArrayList;
public class FunNode implements ISyntaxVisitable, ISemanticVisitable, ICVisitable {
public String name;
public LeafID leaf;
public ArrayList<ParDeclNode> pardecl;
public TypeNode typeNode;
public BodyNode bodyNode;
public FunNode(String name, LeafID leaf, ArrayList<ParDeclNode> pardecl,TypeNode typeNode, BodyNode bodyNode){
this.name=name;
this.leaf=leaf;
this.pardecl=pardecl;
this.typeNode=typeNode;
this.bodyNode=bodyNode;
}
public FunNode(String name, LeafID leaf, ArrayList<ParDeclNode> pardecl, BodyNode bodyNode){
this.name=name;
this.leaf=leaf;
this.pardecl=pardecl;
this.typeNode=null;
this.bodyNode=bodyNode;
}
public void setType(String type){
this.typeNode.type = type;
}
public TypeNode getTypeNode(){
return this.typeNode;
}
@Override
public Element accept(ISyntaxVisitor v) {
return v.visit(this);
}
@Override
public void accept(ISemanticVisitor v) { v.visit(this);}
@Override
public void accept(ICVisitor v) { v.visit(this); }
}