aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/binary.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/data/binary.lux22
1 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux
index 11bc86754..185a142bf 100644
--- a/stdlib/source/library/lux/data/binary.lux
+++ b/stdlib/source/library/lux/data/binary.lux
@@ -194,7 +194,7 @@
(-> Nat Binary (Try I64))
(if (n.< (..!size binary) idx)
(#try.Success (!read idx binary))
- (exception.throw ..index_out_of_bounds [(..!size binary) idx])))
+ (exception.except ..index_out_of_bounds [(..!size binary) idx])))
(def: #export (read/16 idx binary)
(-> Nat Binary (Try I64))
@@ -202,7 +202,7 @@
(#try.Success ($_ i64.or
(i64.left_shift 8 (!read idx binary))
(!read (n.+ 1 idx) binary)))
- (exception.throw ..index_out_of_bounds [(..!size binary) idx])))
+ (exception.except ..index_out_of_bounds [(..!size binary) idx])))
(def: #export (read/32 idx binary)
(-> Nat Binary (Try I64))
@@ -212,7 +212,7 @@
(i64.left_shift 16 (!read (n.+ 1 idx) binary))
(i64.left_shift 8 (!read (n.+ 2 idx) binary))
(!read (n.+ 3 idx) binary)))
- (exception.throw ..index_out_of_bounds [(..!size binary) idx])))
+ (exception.except ..index_out_of_bounds [(..!size binary) idx])))
(def: #export (read/64 idx binary)
(-> Nat Binary (Try I64))
@@ -226,14 +226,14 @@
(i64.left_shift 16 (!read (n.+ 5 idx) binary))
(i64.left_shift 8 (!read (n.+ 6 idx) binary))
(!read (n.+ 7 idx) binary)))
- (exception.throw ..index_out_of_bounds [(..!size binary) idx])))
+ (exception.except ..index_out_of_bounds [(..!size binary) idx])))
(def: #export (write/8 idx value binary)
(-> Nat (I64 Any) Binary (Try Binary))
(if (n.< (..!size binary) idx)
(#try.Success (|> binary
(!write idx value)))
- (exception.throw ..index_out_of_bounds [(..!size binary) idx])))
+ (exception.except ..index_out_of_bounds [(..!size binary) idx])))
(def: #export (write/16 idx value binary)
(-> Nat (I64 Any) Binary (Try Binary))
@@ -241,7 +241,7 @@
(#try.Success (|> binary
(!write idx (i64.right_shift 8 value))
(!write (n.+ 1 idx) value)))
- (exception.throw ..index_out_of_bounds [(..!size binary) idx])))
+ (exception.except ..index_out_of_bounds [(..!size binary) idx])))
(def: #export (write/32 idx value binary)
(-> Nat (I64 Any) Binary (Try Binary))
@@ -251,7 +251,7 @@
(!write (n.+ 1 idx) (i64.right_shift 16 value))
(!write (n.+ 2 idx) (i64.right_shift 8 value))
(!write (n.+ 3 idx) value)))
- (exception.throw ..index_out_of_bounds [(..!size binary) idx])))
+ (exception.except ..index_out_of_bounds [(..!size binary) idx])))
(def: #export (write/64 idx value binary)
(-> Nat (I64 Any) Binary (Try Binary))
@@ -274,7 +274,7 @@
(!write (n.+ 5 idx) (i64.right_shift 16 value))
(!write (n.+ 6 idx) (i64.right_shift 8 value))
(!write (n.+ 7 idx) value))))
- (exception.throw ..index_out_of_bounds [(..!size binary) idx])))
+ (exception.except ..index_out_of_bounds [(..!size binary) idx])))
(implementation: #export equivalence
(Equivalence Binary)
@@ -309,7 +309,7 @@
(-> Nat Nat Binary Nat Binary (Try Binary))
(with_expansions [<jvm> (as_is (do try.monad
[_ (java/lang/System::arraycopy source (.int source_offset) target (.int target_offset) (.int bytes))]
- (wrap target)))]
+ (in target)))]
(for {@.old <jvm>
@.jvm <jvm>}
@@ -324,7 +324,7 @@
target)
(recur (inc idx)))
(#try.Success target)))
- (exception.throw ..cannot_copy_bytes [bytes source_input target_output]))))))
+ (exception.except ..cannot_copy_bytes [bytes source_input target_output]))))))
(def: #export (slice offset length binary)
(-> Nat Nat Binary (Try Binary))
@@ -337,7 +337,7 @@
## Default
(..copy length offset binary 0 (..create length))))
- (exception.throw ..slice_out_of_bounds [size offset length]))))
+ (exception.except ..slice_out_of_bounds [size offset length]))))
(def: #export (drop offset binary)
(-> Nat Binary Binary)