]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/java/Builtins.java
Getting rid of *Array and replace with Vector * (SCL)
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / java / Builtins.java
index e3b429133f2198f65aa4a6b97c75ac2e2b7189c2..ec82b3e4a1aaff2c319c3c82be66b3e37c5d392d 100644 (file)
@@ -15,6 +15,7 @@ import org.simantics.scl.compiler.constants.NoRepConstant;
 import org.simantics.scl.compiler.constants.SCLConstant;
 import org.simantics.scl.compiler.constants.SCLConstructor;
 import org.simantics.scl.compiler.constants.singletons.BindingConstant;
+import org.simantics.scl.compiler.constants.singletons.ClassConstant;
 import org.simantics.scl.compiler.constants.singletons.FailFunction;
 import org.simantics.scl.compiler.constants.singletons.JustConstant;
 import org.simantics.scl.compiler.constants.singletons.NothingConstant;
@@ -88,16 +89,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);
@@ -209,6 +201,12 @@ public class Builtins extends ConcreteModule {
         addValue("freezeMVector", new FreezeMVector());
         addValue("setMVector", SetMVector.INSTANCE);       
         
+        StandardTypeConstructor ClassC = new StandardTypeConstructor(Types.CLASS, Kinds.STAR_TO_STAR, 
+                TypeDesc.forClass("java/lang/Class"));
+        ClassC.setType(Types.CLASS, A);
+        addTypeDescriptor("Class", ClassC);
+        addValue("classObject", ClassConstant.INSTANCE);
+        
         // *** fail ***
         
         addValue("fail", FailFunction.INSTANCE).documentation =