/**
 * miniJava Abstract Syntax Tree classes
 * @author prins
 * @version COMP 520 (v2.2)
 */

package miniJava.AbstractSyntaxTrees;

import miniJava.SyntacticAnalyzer.SourcePosition;

public class ArrayType extends TypeDenoter {
	public ArrayType(TypeDenoter eltType, SourcePosition posn){
		super(TypeKind.ARRAY, posn);
		this.eltType = eltType;
	}

	public <A, R> R visit(Visitor<A, R> v, A o){
		return v.visitArrayType(this, o);
	}

	public TypeDenoter eltType;

	@Override
	public boolean equals(TypeDenoter other){
		return other != null && this.typeKind == other.typeKind && other instanceof ArrayType && this.eltType.equals(((ArrayType)other).eltType);
	}
	
	@Override
	public String toPrettyString(){
		return "ClassType (" + eltType + ")";
	}
}
