package de.dhbwstuttgart.syntaxtree.statement;

import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
import de.dhbwstuttgart.typeinference.constraints.ConstraintsFactory;
import org.antlr.v4.runtime.Token;


public class Return extends Statement
{
    private Expression retexpr;

    public Return(Expression retExpr, Token offset)
    {
        super(retExpr.getType(),offset);
        this.retexpr = retExpr;
    }

    @Override
    public ConstraintSet getConstraints(TypeInferenceBlockInformation info) {
        ConstraintSet ret = retexpr.getConstraints(info);
        ret.addUndConstraint(ConstraintsFactory.createPair(
                this.getType(),info.getCurrentMethod().getType(), info));
        return ret;
    }
    
    // @Sebastian
    public Expression get_Expression() {
    	return retexpr; 
    }
    
    
}
