-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFunctionCallExpr.java
More file actions
36 lines (30 loc) · 902 Bytes
/
Copy pathFunctionCallExpr.java
File metadata and controls
36 lines (30 loc) · 902 Bytes
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
package cwp.ast;
import java.util.ArrayList;
public class FunctionCallExpr extends Expr {
public Expr first;
public ArrayList<Expr> args;
public FunctionCallExpr(Expr first, ArrayList<Expr> args, boolean callable) {
super(first.initTok, callable);
this.first = first;
this.args = args;
}
@Override
public String toString() {
return "FunctionCallExpr: " + initTok.toString();
}
@Override
public String gen() {
StringBuilder sb = new StringBuilder("(");
sb.append(first.gen());
if (!args.isEmpty()) sb.append(" ");
for (int i = 0; i < args.size() - 1; i++) {
sb.append(args.get(i).gen());
sb.append(" ");
}
if (!args.isEmpty()) {
sb.append(args.get(args.size() - 1).gen());
}
sb.append(")");
return sb.toString();
}
}