]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/java/Builtins.java
(refs #7809) Added builtin Pure type to indicate no effects
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / java / Builtins.java
index ec82b3e4a1aaff2c319c3c82be66b3e37c5d392d..e23e378efd668e6c1fbafa87c8ed26c527ea7865 100644 (file)
@@ -23,6 +23,7 @@ import org.simantics.scl.compiler.constants.singletons.ThrowFunction;
 import org.simantics.scl.compiler.constants.singletons.TypeOfConstant;
 import org.simantics.scl.compiler.constants.singletons.TypeOfProxyConstant;
 import org.simantics.scl.compiler.constants.singletons.TypeProxyConstant;
+import org.simantics.scl.compiler.constants.singletons.TypeValueConstant;
 import org.simantics.scl.compiler.elaboration.fundeps.Fundep;
 import org.simantics.scl.compiler.elaboration.modules.Documentation;
 import org.simantics.scl.compiler.elaboration.modules.PrivateProperty;
@@ -99,6 +100,8 @@ public class Builtins extends ConcreteModule {
         addEffectConstructor("Proc", new EffectConstructor(Types.PROC));
         addEffectConstructor("Exception", new EffectConstructor(Types.EXCEPTION));
         
+        addTypeAlias("Pure", TVar.EMPTY_ARRAY, Types.NO_EFFECTS);
+        
         //addTypeDescriptor("->", new StandardTypeConstructor(Kinds.STAR_TO_STAR_TO_STAR, Constants.FUNCTION));
         addTypeDescriptor("[]", new StandardTypeConstructor(Types.LIST, Kinds.STAR_TO_STAR, Constants.LIST));        
         addTypeDescriptor("@", new StandardTypeConstructor(Types.PUNIT, Kinds.STAR, Constants.TUPLE[0]));
@@ -230,7 +233,7 @@ public class Builtins extends ConcreteModule {
                     );
             block.addStatement(apply);
             
-            block.setExit(new Jump(runProcFunction.getReturnCont().createOccurrence(), 
+            block.setExit(new Jump(-1, runProcFunction.getReturnCont().createOccurrence(), 
                     x.createOccurrence()));
             
             runProcFunction.addBlock(block);
@@ -303,6 +306,7 @@ public class Builtins extends ConcreteModule {
             // typeOf :: Typeable a => a -> Type
             addValue("typeOf", TypeOfConstant.INSTANCE)
             .documentation = "Returns the type of the value given as a parameter.";
+            addValue("typeValue", TypeValueConstant.INSTANCE);
             addValue("typeOfProxy", TypeOfProxyConstant.INSTANCE)
             .documentation = "Returns the type of the type proxy given as a parameter.";
             addValue("TypeProxy", TypeProxyConstant.INSTANCE);