blob: ea4a5e4fdc7e949f576aed58eac4e4dd82b60d25 (
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
|
package org.zwobble.couscous.interpreter;
import java.util.HashMap;
import java.util.Map;
import org.zwobble.couscous.values.ConcreteType;
import org.zwobble.couscous.values.IntegerValue;
import org.zwobble.couscous.values.InterpreterValue;
public class Environment {
private Map<Integer, InterpreterValue> stackFrame;
public Environment(Map<Integer, InterpreterValue> stackFrame) {
this.stackFrame = new HashMap<>(stackFrame);
}
public InterpreterValue get(int referentId) {
return stackFrame.get(referentId);
}
public void put(int referentId, InterpreterValue value) {
stackFrame.put(referentId, value);
}
public ConcreteType<?> findClass(String className) {
if (className == "java.lang.Integer") {
return IntegerValue.TYPE;
} else {
throw new UnsupportedOperationException();
}
}
}
|