diff options
Diffstat (limited to 'stdlib/source/lux/host.jvm.lux')
-rw-r--r-- | stdlib/source/lux/host.jvm.lux | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 41d567165..002208fd2 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -352,28 +352,6 @@ class-params)] (` (host (~ (ast;symbol ["" class-name])) [(~@ =params)])))) -(def: (stack-trace->text trace) - (-> StackTrace Text) - (let [size (_lux_proc ["jvm" "arraylength"] [trace]) - idxs (list;n.range +0 (n.dec size))] - (|> idxs - (map (: (-> Nat Text) - (lambda [idx] - (_lux_proc ["jvm" "invokevirtual:java.lang.Object:toString:"] - [(_lux_proc ["jvm" "aaload"] [trace idx])])))) - (text;join-with "\n") - ))) - -(def: (get-stack-trace t) - (-> (host java.lang.Throwable) StackTrace) - (_lux_proc ["jvm" "invokevirtual:java.lang.Throwable:getStackTrace:"] [t])) - -(def: #hidden (throwable->text t) - (All [a] (-> (host java.lang.Throwable) (Either Text a))) - (#;Left (format (_lux_proc ["jvm" "invokevirtual:java.lang.Object:toString:"] [t]) - "\n" - (|> t get-stack-trace stack-trace->text)))) - (def: empty-imports ClassImports (list)) @@ -1497,9 +1475,8 @@ "If it succeeds, you get (#;Right result)." "If it fails, you get (#;Left error+stack-traces-as-text)." (try (risky-computation input)))} - (wrap (list (`' (_lux_proc ["jvm" "try"] - [(#;Right (~ expr)) - ;;throwable->text]))))) + (with-gensyms [g!_] + (wrap (list (`' (_lux_proc ["lux" "try"] [(lambda [(~ g!_)] (~ expr))])))))) (syntax: #export (instance? [#let [imports (class-imports *compiler*)]] [class (generic-type^ imports (list))] |