-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathParams.java
More file actions
41 lines (36 loc) · 825 Bytes
/
Params.java
File metadata and controls
41 lines (36 loc) · 825 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
37
38
39
40
41
import java.util.ArrayList;
class Params extends ExampleToken implements Token
{
Expr expr;
Params params;
public Params(Expr e)
{
expr = e;
params = null;
}
public Params(Expr e, Params p)
{
expr = e;
params = p;
}
public String toString(int t)
{
return expr.toString(t) + (params != null ? ", " + params.toString(t) : "");
}
public ArrayList<FullType> typeCheck() throws ExampleException
{
ArrayList<FullType> list = new ArrayList<FullType>();
list.add(expr.typeCheck());
if (params != null)
list.addAll(params.typeCheck());
return list;
}
public ArrayList<Object> execute()
{
ArrayList<Object> list = new ArrayList<Object>();
list.add(expr.execute());
if (params != null)
list.addAll(params.execute());
return list;
}
}