X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Felaboration%2Fjava%2FBuiltins.java;h=e3b429133f2198f65aa4a6b97c75ac2e2b7189c2;hp=4d48d1e9cb1442ec5854728b2b83518e985b859b;hb=3216affb4ed0e73a5601be223638f4f1a41fb26a;hpb=35e73f300e2101c436dcc23c9a0f9e12ecc81d59 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 4d48d1e9c..e3b429133 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 @@ -18,11 +18,13 @@ import org.simantics.scl.compiler.constants.singletons.BindingConstant; import org.simantics.scl.compiler.constants.singletons.FailFunction; import org.simantics.scl.compiler.constants.singletons.JustConstant; import org.simantics.scl.compiler.constants.singletons.NothingConstant; +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.elaboration.fundeps.Fundep; import org.simantics.scl.compiler.elaboration.modules.Documentation; +import org.simantics.scl.compiler.elaboration.modules.PrivateProperty; import org.simantics.scl.compiler.elaboration.modules.SCLValue; import org.simantics.scl.compiler.elaboration.modules.TypeClass; import org.simantics.scl.compiler.errors.Locations; @@ -103,6 +105,7 @@ public class Builtins extends ConcreteModule { addTypeDescriptor("Variant", new StandardTypeConstructor(Types.VARIANT, Kinds.STAR, TypeDesc.forClass(Variant.class))); addEffectConstructor("Proc", new EffectConstructor(Types.PROC)); + addEffectConstructor("Exception", new EffectConstructor(Types.EXCEPTION)); //addTypeDescriptor("->", new StandardTypeConstructor(Kinds.STAR_TO_STAR_TO_STAR, Constants.FUNCTION)); addTypeDescriptor("[]", new StandardTypeConstructor(Types.LIST, Kinds.STAR_TO_STAR, Constants.LIST)); @@ -152,10 +155,12 @@ public class Builtins extends ConcreteModule { // *** Lists *** for(int arity=0;arity<=Constants.MAX_LIST_LITERAL_LENGTH;++arity) { - LIST_CONSTRUCTORS[arity] = addValue("_list_literal_" + arity + "_", + SCLValue value = addValue("_list_literal_" + arity + "_", arity == 0 ? new EmptyListConstructor() : new ListConstructor(arity) ); + value.addProperty(PrivateProperty.INSTANCE); + LIST_CONSTRUCTORS[arity] = value; } // *** Boolean *** @@ -177,6 +182,10 @@ public class Builtins extends ConcreteModule { new Constructor(Locations.NO_LOCATION, MaybeType.INSTANCE, Just.getName(), new Type[] {MaybeType.INSTANCE.parameters[0]}, null) ); + // *** Dynamic *** + + addValue("Dynamic", DynamicConstructor.INSTANCE); + // *** Vector *** TypeClass VecCompC = new TypeClass(Locations.NO_LOCATION, @@ -204,6 +213,8 @@ public class Builtins extends ConcreteModule { addValue("fail", FailFunction.INSTANCE).documentation = "Throws a runtime exeception with the given string as a description."; + addValue("throw", ThrowFunction.INSTANCE).documentation = + "Throws a given exception."; // *** runProc *** @@ -278,7 +289,12 @@ public class Builtins extends ConcreteModule { "union", Types.NO_EFFECTS, Type, Type, Type)); - + addValue("TUnion3", new JavaStaticMethod( + "org/simantics/scl/compiler/types/Types", + "union", + Types.NO_EFFECTS, + Type, Type, Type, Type)); + StandardTypeConstructor TypeC = new StandardTypeConstructor(Type, Kinds.STAR, TypeDesc.forClass("org/simantics/scl/compiler/types/Type")); TypeC.setType(Type);