]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/singletons/TypeOfProxyConstant.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / constants / singletons / TypeOfProxyConstant.java
diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/singletons/TypeOfProxyConstant.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/singletons/TypeOfProxyConstant.java
new file mode 100644 (file)
index 0000000..4331a3d
--- /dev/null
@@ -0,0 +1,32 @@
+package org.simantics.scl.compiler.constants.singletons;\r
+\r
+import org.simantics.scl.compiler.constants.FunctionValue;\r
+import org.simantics.scl.compiler.internal.codegen.references.Val;\r
+import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;\r
+import org.simantics.scl.compiler.types.TCon;\r
+import org.simantics.scl.compiler.types.TVar;\r
+import org.simantics.scl.compiler.types.Type;\r
+import org.simantics.scl.compiler.types.Types;\r
+import org.simantics.scl.compiler.types.kinds.Kinds;\r
+\r
+public class TypeOfProxyConstant extends FunctionValue {\r
+    private static final TVar A = Types.var(Kinds.STAR);\r
+    private static final TCon Type = Types.con(Types.BUILTIN, "Type");\r
+    public static final TypeOfProxyConstant INSTANCE = new TypeOfProxyConstant();\r
+    \r
+    private TypeOfProxyConstant() {\r
+        super(new TVar[] {A}, Types.NO_EFFECTS, Type, \r
+                Types.pred(Types.TYPEABLE, A), Types.apply(Types.TYPE_PROXY, A));\r
+    }\r
+    \r
+    @Override\r
+    public Type applyExact(MethodBuilder mb, Val[] parameters) {\r
+        mb.push(parameters[0], Type);\r
+        return getReturnType();\r
+    }\r
+    \r
+    @Override\r
+    public String toString() {\r
+        return "typeOfProxy";\r
+    }\r
+}
\ No newline at end of file