package edu.cmu.cs.l3.tree;

public class IRCall extends IRExpression {

    public IRCall(IRName name, IRExpressionList params) {
	m_params = params; m_name = name;

	m_classname = "IRCall";
    }

    public IRExpressionList getParams() {
	return m_params;
    }

    public IRName getName() {
        return m_name;
    }

    public IRExpression build(IRExpressionList exps) {

	IRCall call = null;

        if (exps == null)
            call = new IRCall(m_name, new IRExpressionList());
        else
            call = new IRCall(m_name, exps);

	return call;
    }

    public IRExpressionList getComponents() {
	//IRExpressionList comps = new IRExpressionList();
	//return comps.prepend(m_params).prepend(m_name);
        return m_params;
    }

    public String toString() {
	String ret =  "[" + super.toString() + "(" + m_name + "): ";
	for(int i = 0; i < m_params.getSize(); i++) {
	    ret += " " + m_params.getExpression(i).toString();
	}
	return ret + "]";
    }

    private IRExpressionList m_params;
    private IRName m_name;
}
