1 package org.simantics.scl.compiler.internal.codegen.types;
3 import org.cojen.classfile.TypeDesc;
4 import org.simantics.scl.compiler.elaboration.modules.TypeConstructor;
5 import org.simantics.scl.compiler.types.TCon;
6 import org.simantics.scl.compiler.types.TVar;
7 import org.simantics.scl.compiler.types.Type;
8 import org.simantics.scl.compiler.types.kinds.Kind;
10 public class StandardTypeConstructor extends TypeConstructor {
11 private TypeDesc typeDesc; // null, if trivial data type (one constructor with one parameter)
12 public boolean external;
14 public StandardTypeConstructor(TCon con, Kind kind) {
18 public StandardTypeConstructor(TCon con, Kind kind, TypeDesc typeDesc) {
20 this.typeDesc = typeDesc;
23 public StandardTypeConstructor(TCon con, Kind kind, TypeDesc typeDesc, String documentation) {
25 this.typeDesc = typeDesc;
26 this.documentation = documentation;
29 public StandardTypeConstructor(TCon name, TVar[] parameters, TypeDesc typeDesc) {
30 super(name, parameters);
31 this.typeDesc = typeDesc;
34 public void setTypeDesc(TypeDesc typeDesc) {
35 this.typeDesc = typeDesc;
38 public TypeDesc getTypeDesc() {
43 public TypeDesc construct(JavaTypeTranslator translator, Type[] parameters) {
45 typeDesc = translator.toTypeDesc(constructors[0].parameterTypes[0]);