From 074cf59788feedea1837d60b133142dd73c43058 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Thu, 24 Aug 2017 11:59:27 +0300 Subject: [PATCH] (refs #7448) Added Exception effect Change-Id: I7a684e1d4b095924d03fd1fdbba2a7aa93794ada --- .../org/simantics/scl/compiler/elaboration/java/Builtins.java | 1 + .../src/org/simantics/scl/compiler/types/Types.java | 1 + bundles/org.simantics.scl.runtime/scl/Prelude.scl | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) 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 6df643ea3..45638c056 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 @@ -103,6 +103,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)); diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java index 9ea064cfd..a3db2df52 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java @@ -110,6 +110,7 @@ public class Types { public static final TUnion NO_EFFECTS = new TUnion(); public static final TCon PROC = con(BUILTIN, "Proc"); + public static final TCon EXCEPTION = con(BUILTIN, "Exception"); public static final TCon BRANCH_POINT = con(BUILTIN, "BranchPoint"); diff --git a/bundles/org.simantics.scl.runtime/scl/Prelude.scl b/bundles/org.simantics.scl.runtime/scl/Prelude.scl index 818c50543..f0eca0eb2 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.scl +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.scl @@ -2123,7 +2123,7 @@ importJava "org.simantics.scl.runtime.procedure.Procedures" where "Executes the given expression and catches certain class of exceptions (specified by the catch handler that is given as a second parameter.)" @JavaName catch_ - catch :: VecComp ex => ( a) -> (ex -> a) -> a + catch :: VecComp ex => ( a) -> (ex -> a) -> a importJava "java.lang.Throwable" where data Throwable -- 2.43.2