32 lines
753 B
Java
32 lines
753 B
Java
package Models.Expressions;
|
|
|
|
import Models.Values.IValue;
|
|
import Exceptions.BaseException;
|
|
import Models.Program.IDictionary;
|
|
import Models.Program.IHeap;
|
|
import Models.Types.IType;
|
|
|
|
public class ValueExpression implements IExpression {
|
|
private IValue value;
|
|
|
|
public ValueExpression(IValue value) {
|
|
this.value = value;
|
|
}
|
|
|
|
public IValue evaluate(IDictionary<String, IValue> table, IHeap heap) throws BaseException {
|
|
return value;
|
|
}
|
|
|
|
public IExpression copy() {
|
|
return new ValueExpression(value);
|
|
}
|
|
|
|
public String toString() {
|
|
return value.toString();
|
|
}
|
|
|
|
public IType typeCheck(IDictionary<String, IType> typeTable) throws BaseException {
|
|
return value.getType();
|
|
}
|
|
}
|