1 package org.simantics.scl.compiler.internal.codegen.types;
4 import org.cojen.classfile.TypeDesc;
5 import org.simantics.scl.compiler.elaboration.modules.TypeConstructor;
6 import org.simantics.scl.compiler.types.TCon;
7 import org.simantics.scl.compiler.types.TVar;
8 import org.simantics.scl.compiler.types.Type;
9 import org.simantics.scl.compiler.types.Types;
10 import org.simantics.scl.compiler.types.kinds.Kinds;
12 public class VectorType extends TypeConstructor {
13 private static final TVar ELEMENT_TYPE = Types.var(Kinds.STAR);
15 public VectorType(TCon constructor) {
16 super(constructor, ELEMENT_TYPE);
20 public TypeDesc construct(JavaTypeTranslator translator, Type[] parameters) {
21 Type parameter = Types.canonical(parameters[0]);
22 if(parameter instanceof TVar)
23 return TypeDesc.OBJECT;
25 return translator.toTypeDesc(parameter).toArrayType();