]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/UnsafeCoerce.java
Ensure GetElementClassRequest is not constructed without elementFactory
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / constants / UnsafeCoerce.java
1 package org.simantics.scl.compiler.constants;\r
2 \r
3 import org.simantics.scl.compiler.internal.codegen.references.Val;\r
4 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;\r
5 import org.simantics.scl.compiler.types.TVar;\r
6 import org.simantics.scl.compiler.types.Type;\r
7 import org.simantics.scl.compiler.types.Types;\r
8 import org.simantics.scl.compiler.types.kinds.Kinds;\r
9 \r
10 public class UnsafeCoerce extends FunctionValue {    \r
11     private static TVar A = Types.var(Kinds.STAR);\r
12     private static TVar B = Types.var(Kinds.STAR);\r
13     public static final UnsafeCoerce INSTANCE = new UnsafeCoerce();\r
14     \r
15     private UnsafeCoerce() {\r
16         super(new TVar[] {A, B}, Types.NO_EFFECTS, B, A);\r
17     }\r
18     \r
19     @Override\r
20     public Type applyExact(MethodBuilder mb, Val[] parameters) {\r
21         mb.pushBoxed(parameters[0]);\r
22         return getReturnType();\r
23     }\r
24 }\r