package com.example.Models.Expressions;

import com.example.Models.Values.IValue;
import com.example.Exceptions.BaseException;
import com.example.Models.Program.IDictionary;
import com.example.Models.Program.IHeap;
import com.example.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();
    }
}
