diff options
Diffstat (limited to 'lux-ruby/source')
-rw-r--r-- | lux-ruby/source/program.lux | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 6c541c74c..534b78e34 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -238,12 +238,12 @@ output (is (Array Any) (array.empty size))]) (if (n.< size idx) - (case (org/jruby/RubyArray::get (ffi.as_int (.int idx)) host_object) + (when (org/jruby/RubyArray::get (ffi.as_int (.int idx)) host_object) {.#None} (again (++ idx) output) {.#Some value} - (case (read value) + (when (read value) {try.#Success lux_value} (again (++ idx) (array.has! idx lux_value output)) @@ -258,7 +258,7 @@ (def (read_variant read host_object) (-> Translator org/jruby/RubyHash (Try Any)) - (case [(org/jruby/RubyHash::get (ffi.as_string runtime.variant_tag_field) host_object) + (when [(org/jruby/RubyHash::get (ffi.as_string runtime.variant_tag_field) host_object) (org/jruby/RubyHash::get (ffi.as_string runtime.variant_flag_field) host_object) (org/jruby/RubyHash::get (ffi.as_string runtime.variant_value_field) host_object)] [{.#Some tag} ?flag {.#Some value}] @@ -269,7 +269,7 @@ java/lang/Long::intValue (is java/lang/Integer))) (is Any - (case ?flag + (when ?flag {.#Some _} "" @@ -287,7 +287,7 @@ (`` (<| (if (ffi.null? host_object) (exception.except ..nil_has_no_lux_representation [])) (,, (with_template [<class> <post_processing>] - [(case (ffi.as <class> host_object) + [(when (ffi.as <class> host_object) {.#Some typed_object} (`` (|> typed_object (,, (template.spliced <post_processing>)))) @@ -327,7 +327,7 @@ (-> java/lang/Object org/jruby/runtime/builtin/IRubyObject)) (function (again value) (`` (<| (,, (with_template [<when> <then>] - [(case (ffi.as <when> value) + [(when (ffi.as <when> value) {.#Some value} (|> value <then> @@ -401,7 +401,7 @@ (list#each (function (_ index) (ffi.read! index args))) (monad.each ! (|>> (ffi.is java/lang/Object) ..read))) - output (case args + output (when args (list arg/0) (in ((as (-> Any java/lang/Object) value) arg/0)) @@ -462,9 +462,9 @@ block org/jruby/runtime/Block]) org/jruby/runtime/builtin/IRubyObject (let [member (ffi.read! 0 args)] - (<| (case (ffi.as org/jruby/RubyFixnum member) + (<| (when (ffi.as org/jruby/RubyFixnum member) {.#Some member} - (case (array.item (.nat (ffi.of_long (org/jruby/RubyFixnum::getLongValue member))) value) + (when (array.item (.nat (ffi.of_long (org/jruby/RubyFixnum::getLongValue member))) value) {.#Some value} (wrapped_lux_value (as_expected useful_object_class) lux_structure value) @@ -472,9 +472,9 @@ ..ruby_nil) {.#None}) - (case (ffi.as org/jruby/RubyString member) + (when (ffi.as org/jruby/RubyString member) {.#Some member} - (case (ffi.of_string (org/jruby/RubyString::asJavaString member)) + (when (ffi.of_string (org/jruby/RubyString::asJavaString member)) runtime.variant_tag_field (|> value (array.item 0) @@ -485,7 +485,7 @@ (ffi.is org/jruby/runtime/builtin/IRubyObject)) runtime.variant_flag_field - (case (array.item 1 value) + (when (array.item 1 value) {.#None} ..ruby_nil @@ -493,7 +493,7 @@ ..lux_unit) runtime.variant_value_field - (case (array.item 2 value) + (when (array.item 2 value) {.#Some value} (wrapped_lux_value (as_expected useful_object_class) lux_structure value) @@ -504,9 +504,9 @@ (panic! (exception.error ..invalid_variant_access [field]))) {.#None}) - (case (ffi.as org/jruby/RubyRange member) + (when (ffi.as org/jruby/RubyRange member) {.#Some member} - (case [(|> member (org/jruby/RubyRange::first thread_context) (ffi.as org/jruby/RubyFixnum)) + (when [(|> member (org/jruby/RubyRange::first thread_context) (ffi.as org/jruby/RubyFixnum)) (|> member (org/jruby/RubyRange::size thread_context) (ffi.as org/jruby/RubyFixnum))] [{.#Some first} {.#Some size}] (let [first (ffi.of_long (org/jruby/RubyFixnum::getLongValue first)) @@ -541,7 +541,7 @@ (<| (ffi.is org/jruby/runtime/builtin/IRubyObject) (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime) ffi.as_boolean - (case (|> args + (when (|> args (ffi.read! 0) (ffi.is java/lang/Object) ..read) @@ -625,11 +625,11 @@ args [org/jruby/runtime/builtin/IRubyObject] block org/jruby/runtime/Block]) org/jruby/runtime/builtin/IRubyObject - (case (|> args + (when (|> args (ffi.read! 0) (ffi.as org/jruby/RubySymbol)) {.#Some method} - (|> (case (|> method + (|> (when (|> method org/jruby/RubySymbol::asJavaString ffi.of_string) (^.or "==" "equal?" @@ -663,7 +663,7 @@ (org/jruby/RubyClass [] (searchWithCache this [method java/lang/String]) org/jruby/runtime/callsite/CacheEntry - (case (ffi.of_string method) + (when (ffi.of_string method) "call" (org/jruby/runtime/callsite/CacheEntry::new (::call useful_object_class lux_structure value) (ffi.as_int +0)) @@ -719,9 +719,9 @@ (def (expander macro inputs lux) Expander - (case (macro! macro) + (when (macro! macro) {.#Some macro} - (case (call_macro inputs lux macro) + (when (call_macro inputs lux macro) {try.#Success output} (|> output (as java/lang/Object) @@ -851,10 +851,10 @@ [inputs (|> inputs (array.list {.#None}) (monad.each ! (|>> (ffi.is java/lang/Object) ..read)))]) - (case inputs + (when inputs ... It seems that org/jruby/runtime/Block::call can misbehave when getting called with a Lux state value. (list info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host) - (case partial_application + (when partial_application (list partial/0 partial/1) (in (..to_host ((as (-> Any Any Any Any) phase) partial/0 @@ -869,7 +869,7 @@ (host_phase partial_application phase))} (list input/0) - (case partial_application + (when partial_application (list) (in (<| (ffi.is org/jruby/runtime/builtin/IRubyObject) (host_phase (list input/0) phase))) @@ -888,7 +888,7 @@ (exception.except ..invaid_phase_application [partial_application inputs])) (list input/0 input/1) - (case partial_application + (when partial_application (list) (in (<| (ffi.is org/jruby/runtime/builtin/IRubyObject) (host_phase (list input/0 input/1) phase))) @@ -903,7 +903,7 @@ (exception.except ..invaid_phase_application [partial_application inputs])) (list input/0 input/1 input/2) - (case partial_application + (when partial_application (list) (in (..to_host ((as (-> Any Any Any Any) phase) input/0 |