aboutsummaryrefslogtreecommitdiff
path: root/lux-ruby
diff options
context:
space:
mode:
Diffstat (limited to 'lux-ruby')
-rw-r--r--lux-ruby/source/program.lux107
1 files changed, 57 insertions, 50 deletions
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux
index 3a55ccafc..cd037a5b1 100644
--- a/lux-ruby/source/program.lux
+++ b/lux-ruby/source/program.lux
@@ -288,6 +288,7 @@
[java/lang/Long [{try.#Success}]]
[java/lang/Double [{try.#Success}]]
[java/lang/String [{try.#Success}]]
+ [org/jruby/RubyFixnum [org/jruby/RubyFixnum::getLongValue {try.#Success}]]
[org/jruby/RubyString [org/jruby/RubyString::asJavaString {try.#Success}]]
[[java/lang/Object] [{try.#Success}]]
[org/jruby/RubyArray [(read_tuple read)]]
@@ -708,10 +709,10 @@
(for [@.old
(as_is (exception: .public (invaid_phase_application [partial_application (List Any)
- arity Nat])
+ arity (List Any)])
(exception.report
["Partial Application" (%.nat (list.size partial_application))]
- ["Arity" (%.nat arity)]))
+ ["Arity" (%.nat (list.size arity))]))
(def: proc_type
org/jruby/runtime/Block$Type
@@ -758,64 +759,70 @@
_ org/jruby/runtime/Block])
org/jruby/runtime/builtin/IRubyObject
(<| try.trusted
- (let [inputs (array.list {.#None} inputs)])
+ (do [! try.monad]
+ [inputs (|> inputs
+ (array.list {.#None})
+ (monad.each ! (|>> (:as java/lang/Object) ..read)))])
(case 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
+ (^ (list partial/0 partial/1))
+ (in (..to_host ((:as (-> Any Any Any Any) phase)
+ partial/0
+ partial/1
+ [info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host])))
+
+ _
+ (exception.except ..invaid_phase_application [partial_application inputs]))
+
(^ (list))
{try.#Success (host_phase partial_application phase)}
(^ (list input/0))
- (do try.monad
- [input/0 (..read (:as java/lang/Object input/0))]
- (case partial_application
- (^ (list))
- (in (host_phase (list input/0) phase))
-
- (^ (list partial/0))
- (in (host_phase (list partial/0 input/0) phase))
-
- (^ (list partial/0 partial/1))
- (in (..to_host ((:as (-> Any Any Any Any) phase)
- partial/0
- partial/1
- input/0)))
-
- _
- (exception.except ..invaid_phase_application [partial_application (list.size inputs)])))
+ (case partial_application
+ (^ (list))
+ (in (host_phase (list input/0) phase))
+
+ (^ (list partial/0))
+ (in (host_phase (list partial/0 input/0) phase))
+
+ (^ (list partial/0 partial/1))
+ (in (..to_host ((:as (-> Any Any Any Any) phase)
+ partial/0
+ partial/1
+ input/0)))
+
+ _
+ (exception.except ..invaid_phase_application [partial_application inputs]))
(^ (list input/0 input/1))
- (do try.monad
- [input/0 (..read (:as java/lang/Object input/0))
- input/1 (..read (:as java/lang/Object input/1))]
- (case partial_application
- (^ (list))
- (in (host_phase (list input/0 input/1) phase))
-
- (^ (list partial/0))
- (in (..to_host ((:as (-> Any Any Any Any) phase)
- partial/0
- input/0
- input/1)))
-
- _
- (exception.except ..invaid_phase_application [partial_application (list.size inputs)])))
+ (case partial_application
+ (^ (list))
+ (in (host_phase (list input/0 input/1) phase))
+
+ (^ (list partial/0))
+ (in (..to_host ((:as (-> Any Any Any Any) phase)
+ partial/0
+ input/0
+ input/1)))
+
+ _
+ (exception.except ..invaid_phase_application [partial_application inputs]))
(^ (list input/0 input/1 input/2))
- (do try.monad
- [input/0 (..read (:as java/lang/Object input/0))
- input/1 (..read (:as java/lang/Object input/1))
- input/2 (..read (:as java/lang/Object input/2))]
- (case partial_application
- (^ (list))
- (in (..to_host ((:as (-> Any Any Any Any) phase)
- input/0
- input/1
- input/2)))
-
- _
- (exception.except ..invaid_phase_application [partial_application (list.size inputs)])))
+ (case partial_application
+ (^ (list))
+ (in (..to_host ((:as (-> Any Any Any Any) phase)
+ input/0
+ input/1
+ input/2)))
+
+ _
+ (exception.except ..invaid_phase_application [partial_application inputs]))
_
- (exception.except ..invaid_phase_application [partial_application (list.size inputs)])))))]
+ (exception.except ..invaid_phase_application [partial_application inputs])))))]
(org/jruby/RubyProc::newProc (!ruby_runtime) block ..proc_type)))
(def: (extender phase_wrapper)
@@ -873,7 +880,7 @@
(let [normal_runtime? (_.do "const_defined?"
(list (_.string (_.code _.command_line_arguments)))
{.#None}
- (_.local "Object"))]
+ (: _.CVar (_.manual "Object")))]
(_.statement
(_.apply_lambda/* (list (runtime.lux//program_args (_.? normal_runtime?
_.command_line_arguments