X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Fjava%2FBuiltins.java;h=e23e378efd668e6c1fbafa87c8ed26c527ea7865;hb=HEAD;hp=5004bc0556355e08e597073e4440dfa5e7761520;hpb=6fd9bc1ec7e95848d0cc15d12825a65a4b57ada5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/java/Builtins.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/java/Builtins.java index 5004bc055..e23e378ef 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/java/Builtins.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/java/Builtins.java @@ -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; @@ -89,16 +90,7 @@ public class Builtins extends ConcreteModule { "64-bit floating point number")); addTypeDescriptor("String", new StandardTypeConstructor(Types.STRING, Kinds.STAR, TypeDesc.STRING, "Unicode string")); - - addTypeDescriptor("BooleanArray", new StandardTypeConstructor(Types.BOOLEAN_ARRAY, Kinds.STAR, TypeDesc.forClass(boolean[].class))); - addTypeDescriptor("ByteArray", new StandardTypeConstructor(Types.BYTE_ARRAY, Kinds.STAR, TypeDesc.forClass(byte[].class))); - addTypeDescriptor("CharacterArray", new StandardTypeConstructor(Types.CHARACTER_ARRAY, Kinds.STAR, TypeDesc.forClass(char[].class))); - addTypeDescriptor("ShortArray", new StandardTypeConstructor(Types.SHORT_ARRAY, Kinds.STAR, TypeDesc.forClass(short[].class))); - addTypeDescriptor("IntegerArray", new StandardTypeConstructor(Types.INTEGER_ARRAY, Kinds.STAR, TypeDesc.forClass(int[].class))); - addTypeDescriptor("LongArray", new StandardTypeConstructor(Types.LONG_ARRAY, Kinds.STAR, TypeDesc.forClass(long[].class))); - addTypeDescriptor("FloatArray", new StandardTypeConstructor(Types.FLOAT_ARRAY, Kinds.STAR, TypeDesc.forClass(float[].class))); - addTypeDescriptor("DoubleArray", new StandardTypeConstructor(Types.DOUBLE_ARRAY, Kinds.STAR, TypeDesc.forClass(double[].class))); - + addTypeDescriptor("Array", new StandardTypeConstructor(Types.con(Types.BUILTIN, "Array"), Kinds.STAR_TO_STAR, TypeDesc.forClass(Object[].class))); addTypeDescriptor("Maybe", MaybeType.INSTANCE); @@ -108,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])); @@ -239,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); @@ -312,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);