package org.simantics.scl.compiler.internal.codegen.types; import org.cojen.classfile.TypeDesc; import org.simantics.scl.compiler.elaboration.modules.TypeConstructor; import org.simantics.scl.compiler.types.TCon; import org.simantics.scl.compiler.types.TVar; import org.simantics.scl.compiler.types.Type; import org.simantics.scl.compiler.types.Types; import org.simantics.scl.compiler.types.kinds.Kinds; public class VectorType extends TypeConstructor { private static final TVar ELEMENT_TYPE = Types.var(Kinds.STAR); public VectorType(TCon constructor) { super(constructor, ELEMENT_TYPE); } @Override public TypeDesc construct(JavaTypeTranslator translator, Type[] parameters) { Type parameter = Types.canonical(parameters[0]); if(parameter instanceof TVar) return TypeDesc.OBJECT; else return translator.toTypeDesc(parameter).toArrayType(); } }