package edu.cmu.cs.l3.semant;

import java.util.List;

public class TyFunction extends Ty {

    public TyFunction(String name, Ty rettype, List params) {
	super(0,name); m_rettype = rettype; m_params = params;

	int i;
	String fname = "("+name+":(";
	if (rettype != null) {
	    fname += rettype.getName() + "){";
	}
	else {
	    fname += "void){";
	}
	for (i = 0; i < m_params.size(); i++) {
	    Ty pty = (Ty)m_params.get(i);
	    fname += pty.getName();
	    if (i != m_params.size()-1) {
		fname += ",";
	    }
	}
	fname += "})";

	m_name = fname;
    }

    public int getEqSize() {
	return 0;
    }

    public Ty getReturnType() {
	return m_rettype;
    }

    public List getParameters() {
	return m_params;
    }

    public boolean isExtern() {
        return m_extern;
    }

    public void setExtern() {
        m_extern = true;
    }

    private Ty m_rettype;
    private List m_params;
    private boolean m_extern=false;

}