]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/types/MaybeType.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / codegen / types / MaybeType.java
1 package org.simantics.scl.compiler.internal.codegen.types;
2
3 import org.cojen.classfile.TypeDesc;
4 import org.simantics.scl.compiler.elaboration.modules.TypeConstructor;
5 import org.simantics.scl.compiler.types.Type;
6 import org.simantics.scl.compiler.types.Types;
7 import org.simantics.scl.compiler.types.kinds.Kinds;
8
9 public class MaybeType extends TypeConstructor {
10     public static final MaybeType INSTANCE = new MaybeType();
11     
12     private MaybeType() {
13         super(Types.MAYBE, Kinds.STAR_TO_STAR);
14         isOpen = false;
15         setType(Types.con(Types.BUILTIN, "Maybe"), Types.var(Kinds.STAR));
16         documentation = "Represents an optional value.";
17     }
18     
19     @Override
20     public TypeDesc construct(JavaTypeTranslator translator, Type[] parameters) {
21         return JavaTypeTranslator.toObjectType(translator.toTypeDesc(parameters[0]));
22     }
23
24 }