|
1 |
| package edu.rice.cs.dynamicjava.interpreter; |
|
2 |
| |
|
3 |
| import edu.rice.cs.plt.iter.IterUtil; |
|
4 |
| |
|
5 |
| import edu.rice.cs.dynamicjava.symbol.*; |
|
6 |
| import edu.rice.cs.dynamicjava.symbol.type.Type; |
|
7 |
| |
|
8 |
| import static edu.rice.cs.plt.debug.DebugUtil.debug; |
|
9 |
| |
|
10 |
| |
|
11 |
| public class InitializerContext extends DelegatingContext { |
|
12 |
| |
|
13 |
| private final boolean _isStatic; |
|
14 |
| private final DJClass _c; |
|
15 |
| |
|
16 |
0
| public InitializerContext(TypeContext next, boolean isStatic, DJClass c) {
|
|
17 |
0
| super(next);
|
|
18 |
0
| _isStatic = isStatic;
|
|
19 |
0
| _c = c;
|
|
20 |
| } |
|
21 |
| |
|
22 |
0
| protected InitializerContext duplicate(TypeContext next) {
|
|
23 |
0
| return new InitializerContext(next, _isStatic, _c);
|
|
24 |
| } |
|
25 |
| |
|
26 |
0
| @Override public String makeClassName(String n) {
|
|
27 |
0
| return super.makeAnonymousClassName() + n;
|
|
28 |
| } |
|
29 |
| |
|
30 |
0
| @Override public DJClass getThis() {
|
|
31 |
0
| if (_isStatic) { return null; }
|
|
32 |
0
| else { return super.getThis(); }
|
|
33 |
| } |
|
34 |
| |
|
35 |
0
| @Override public DJClass getThis(String className) {
|
|
36 |
0
| if (_isStatic) { return null; }
|
|
37 |
0
| else { return super.getThis(className); }
|
|
38 |
| } |
|
39 |
| |
|
40 |
0
| @Override public DJClass getThis(Type expected, TypeSystem ts) {
|
|
41 |
0
| if (_isStatic) { return null; }
|
|
42 |
0
| else { return super.getThis(expected, ts); }
|
|
43 |
| } |
|
44 |
| |
|
45 |
0
| @Override public DJClass initializingClass() { return _c; }
|
|
46 |
| |
|
47 |
0
| @Override public Type getReturnType() { return null; }
|
|
48 |
| |
|
49 |
0
| @Override public Iterable<Type> getDeclaredThrownTypes() { return IterUtil.empty(); }
|
|
50 |
| |
|
51 |
| } |