aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/lux.lux7
-rw-r--r--source/lux/host/io.lux10
2 files changed, 10 insertions, 7 deletions
diff --git a/source/lux.lux b/source/lux.lux
index 39cbb7765..ee01c8bdf 100644
--- a/source/lux.lux
+++ b/source/lux.lux
@@ -275,7 +275,8 @@
## (deftype Host
## (& #writer (^ org.objectweb.asm.ClassWriter)
## #loader (^ java.net.URLClassLoader)
-## #classes (^ clojure.lang.Atom)))
+## #classes (^ clojure.lang.Atom)
+## #catching (List Text)))
(_lux_def Host
(#NamedT ["lux" "Host"]
(#TupleT (#Cons [## "lux;writer"
@@ -284,7 +285,9 @@
(#DataT "java.lang.ClassLoader" #Nil)
(#Cons [## "lux;classes"
(#DataT "clojure.lang.Atom" #Nil)
- #Nil])])]))))
+ (#Cons [## "lux;catching"
+ (#AppT List Text)
+ #Nil])])])]))))
(_lux_declare-tags [#writer #loader #classes] Host)
## (deftype (DefData' m)
diff --git a/source/lux/host/io.lux b/source/lux/host/io.lux
index 4542b0519..99e15722d 100644
--- a/source/lux/host/io.lux
+++ b/source/lux/host/io.lux
@@ -30,11 +30,11 @@
(let [in (_jvm_getstatic "java.lang.System" "in")
reader (_jvm_new "java.io.InputStreamReader" ["java.io.InputStream"] [in])
buff-reader (_jvm_new "java.io.BufferedReader" ["java.io.Reader"] [reader])]
- (@io (let [output (: (Either Text <type>) (try <op>))]
- (exec (_jvm_invokeinterface "java.io.Closeable" "close" [] buff-reader [])
- (case output
- (#;Left _) #;None
- (#;Right input) (#;Some input)))))))]
+ (@io (let [output (: (Either Text <type>) (try <op>))
+ _close (: (Either Text (,)) (try (_jvm_invokeinterface "java.io.Closeable" "close" [] buff-reader [])))]
+ (case [output _close]
+ (\or [(#;Left _) _] [_ (#;Left _)]) #;None
+ [(#;Right input) (#;Right _)] (#;Some input))))))]
[read-char Char (_jvm_i2c (_jvm_invokevirtual "java.io.BufferedReader" "read" [] buff-reader []))]
[read-line Text (_jvm_invokevirtual "java.io.BufferedReader" "readLine" [] buff-reader [])]