aboutsummaryrefslogtreecommitdiff
path: root/lux-ruby
diff options
context:
space:
mode:
Diffstat (limited to 'lux-ruby')
-rw-r--r--lux-ruby/source/program.lux356
1 files changed, 178 insertions, 178 deletions
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux
index bd3f1763e..30a276d58 100644
--- a/lux-ruby/source/program.lux
+++ b/lux-ruby/source/program.lux
@@ -759,189 +759,189 @@
[_ (run! content)]
(run! (_.global (reference.artifact context))))))))))
-(for [@.jvm (as_is (exception: .public (invaid_phase_application [partial_application (List Any)
- arity (List Any)])
- (exception.report
- ["Partial Application" (%.nat (list.size partial_application))]
- ["Arity" (%.nat (list.size arity))]))
-
- (def: proc_type
- org/jruby/runtime/Block$Type
- (|> (org/jruby/runtime/Block::NULL_BLOCK)
- (org/jruby/runtime/Block::type)))
-
- (def: phase_block_signature
- org/jruby/runtime/Signature
- (org/jruby/runtime/Signature::THREE_ARGUMENTS))
-
- (def: dummy_static_scope
- org/jruby/parser/StaticScope
- (|> (org/jruby/parser/StaticScopeFactory::new (!ruby_runtime))
- (org/jruby/parser/StaticScopeFactory::getDummyScope)))
-
- (def: phase_block_body
- org/jruby/runtime/BlockBody
- (<| (ffi.:as org/jruby/runtime/BlockBody)
- (ffi.object [] org/jruby/runtime/BlockBody []
- [org/jruby/runtime/Signature ..phase_block_signature]
- ... Methods
- (org/jruby/runtime/BlockBody
- [] (getFile this [])
- java/lang/String
- (ffi.as_string "YOLO"))
-
- (org/jruby/runtime/BlockBody
- [] (getLine this [])
- int
- (ffi.as_int (hex "+ABC,123")))
-
- (org/jruby/runtime/BlockBody
- [] (getStaticScope this [])
- org/jruby/parser/StaticScope
- ..dummy_static_scope)
-
- (org/jruby/runtime/BlockBody
- [] (setStaticScope self [_ org/jruby/parser/StaticScope])
- void
- [])
-
- (org/jruby/runtime/BlockBody
- [] (doYield self [_ org/jruby/runtime/ThreadContext
- _ org/jruby/runtime/Block
- _ org/jruby/runtime/builtin/IRubyObject])
- org/jruby/runtime/builtin/IRubyObject
- (undefined))
-
- (org/jruby/runtime/BlockBody
- [] (doYield self [_ org/jruby/runtime/ThreadContext
- _ org/jruby/runtime/Block
- _ [org/jruby/runtime/builtin/IRubyObject]
- _ org/jruby/runtime/builtin/IRubyObject])
- org/jruby/runtime/builtin/IRubyObject
- (undefined))
- )))
-
- (def: (host_phase partial_application phase)
- (All (_ s i o)
- (-> (List Any) (Phase [extension.Bundle s] i o)
- org/jruby/RubyProc))
- (let [block (ffi.object [] org/jruby/runtime/Block []
- [org/jruby/runtime/BlockBody ..phase_block_body]
- ... Methods
- (org/jruby/runtime/Block
- [] (call this [_thread_context org/jruby/runtime/ThreadContext
- inputs [org/jruby/runtime/builtin/IRubyObject]
- _block org/jruby/runtime/Block])
- org/jruby/runtime/builtin/IRubyObject
- (<| try.trusted
- (do [! try.monad]
- [inputs (|> inputs
- (array.list {.#None})
- (monad.each ! (|>> (ffi.: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 (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
- (host_phase partial_application phase))}
-
- (^ (list input/0))
- (case partial_application
- (^ (list))
- (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
- (host_phase (list input/0) phase)))
-
- (^ (list partial/0))
- (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
- (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))
- (case partial_application
- (^ (list))
- (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
- (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))
- (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 inputs])))))]
- (org/jruby/RubyProc::newProc (!ruby_runtime) block ..proc_type)))
-
- (def: (extender phase_wrapper)
- (-> phase.Wrapper Extender)
- ... TODO: Stop relying on coercions ASAP.
- (<| (:as Extender)
- (function (@self handler))
- (:as Handler)
- (function (@self name phase))
- (:as Phase)
- (function (@self archive parameters))
- (:as Operation)
- (function (@self state))
- (:as Try)
- try.trusted
- (:as Try)
- (do try.monad
- [handler (try.of_maybe (..macro! handler))
- output (org/jruby/RubyProc::call (!ruby_thread_context)
- (|> (ffi.array org/jruby/runtime/builtin/IRubyObject 5)
- (ffi.write! 0 (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
- (org/jruby/RubyString::newInternalFromJavaExternal (!ruby_runtime) (ffi.as_string name))))
- (ffi.write! 1 (:as org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase)))
- (ffi.write! 2 (..to_host archive))
- (ffi.write! 3 (..to_host parameters))
- (ffi.write! 4 (..to_host state)))
- handler)]
- (..read (ffi.:as java/lang/Object output))))))
-
- @.ruby
- (def: (extender phase_wrapper handler)
- (-> phase.Wrapper Extender)
- (:expected handler))])
+(for @.jvm (as_is (exception: .public (invaid_phase_application [partial_application (List Any)
+ arity (List Any)])
+ (exception.report
+ ["Partial Application" (%.nat (list.size partial_application))]
+ ["Arity" (%.nat (list.size arity))]))
+
+ (def: proc_type
+ org/jruby/runtime/Block$Type
+ (|> (org/jruby/runtime/Block::NULL_BLOCK)
+ (org/jruby/runtime/Block::type)))
+
+ (def: phase_block_signature
+ org/jruby/runtime/Signature
+ (org/jruby/runtime/Signature::THREE_ARGUMENTS))
+
+ (def: dummy_static_scope
+ org/jruby/parser/StaticScope
+ (|> (org/jruby/parser/StaticScopeFactory::new (!ruby_runtime))
+ (org/jruby/parser/StaticScopeFactory::getDummyScope)))
+
+ (def: phase_block_body
+ org/jruby/runtime/BlockBody
+ (<| (ffi.:as org/jruby/runtime/BlockBody)
+ (ffi.object [] org/jruby/runtime/BlockBody []
+ [org/jruby/runtime/Signature ..phase_block_signature]
+ ... Methods
+ (org/jruby/runtime/BlockBody
+ [] (getFile this [])
+ java/lang/String
+ (ffi.as_string "YOLO"))
+
+ (org/jruby/runtime/BlockBody
+ [] (getLine this [])
+ int
+ (ffi.as_int (hex "+ABC,123")))
+
+ (org/jruby/runtime/BlockBody
+ [] (getStaticScope this [])
+ org/jruby/parser/StaticScope
+ ..dummy_static_scope)
+
+ (org/jruby/runtime/BlockBody
+ [] (setStaticScope self [_ org/jruby/parser/StaticScope])
+ void
+ [])
+
+ (org/jruby/runtime/BlockBody
+ [] (doYield self [_ org/jruby/runtime/ThreadContext
+ _ org/jruby/runtime/Block
+ _ org/jruby/runtime/builtin/IRubyObject])
+ org/jruby/runtime/builtin/IRubyObject
+ (undefined))
+
+ (org/jruby/runtime/BlockBody
+ [] (doYield self [_ org/jruby/runtime/ThreadContext
+ _ org/jruby/runtime/Block
+ _ [org/jruby/runtime/builtin/IRubyObject]
+ _ org/jruby/runtime/builtin/IRubyObject])
+ org/jruby/runtime/builtin/IRubyObject
+ (undefined))
+ )))
+
+ (def: (host_phase partial_application phase)
+ (All (_ s i o)
+ (-> (List Any) (Phase [extension.Bundle s] i o)
+ org/jruby/RubyProc))
+ (let [block (ffi.object [] org/jruby/runtime/Block []
+ [org/jruby/runtime/BlockBody ..phase_block_body]
+ ... Methods
+ (org/jruby/runtime/Block
+ [] (call this [_thread_context org/jruby/runtime/ThreadContext
+ inputs [org/jruby/runtime/builtin/IRubyObject]
+ _block org/jruby/runtime/Block])
+ org/jruby/runtime/builtin/IRubyObject
+ (<| try.trusted
+ (do [! try.monad]
+ [inputs (|> inputs
+ (array.list {.#None})
+ (monad.each ! (|>> (ffi.: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 (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
+ (host_phase partial_application phase))}
+
+ (^ (list input/0))
+ (case partial_application
+ (^ (list))
+ (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
+ (host_phase (list input/0) phase)))
+
+ (^ (list partial/0))
+ (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
+ (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))
+ (case partial_application
+ (^ (list))
+ (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
+ (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))
+ (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 inputs])))))]
+ (org/jruby/RubyProc::newProc (!ruby_runtime) block ..proc_type)))
+
+ (def: (extender phase_wrapper)
+ (-> phase.Wrapper Extender)
+ ... TODO: Stop relying on coercions ASAP.
+ (<| (:as Extender)
+ (function (@self handler))
+ (:as Handler)
+ (function (@self name phase))
+ (:as Phase)
+ (function (@self archive parameters))
+ (:as Operation)
+ (function (@self state))
+ (:as Try)
+ try.trusted
+ (:as Try)
+ (do try.monad
+ [handler (try.of_maybe (..macro! handler))
+ output (org/jruby/RubyProc::call (!ruby_thread_context)
+ (|> (ffi.array org/jruby/runtime/builtin/IRubyObject 5)
+ (ffi.write! 0 (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject)
+ (org/jruby/RubyString::newInternalFromJavaExternal (!ruby_runtime) (ffi.as_string name))))
+ (ffi.write! 1 (:as org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase)))
+ (ffi.write! 2 (..to_host archive))
+ (ffi.write! 3 (..to_host parameters))
+ (ffi.write! 4 (..to_host state)))
+ handler)]
+ (..read (ffi.:as java/lang/Object output))))))
+
+ @.ruby
+ (def: (extender phase_wrapper handler)
+ (-> phase.Wrapper Extender)
+ (:expected handler)))
(def: (phase_wrapper archive)
(-> Archive (runtime.Operation phase.Wrapper))
(<| phase#in
(:as phase.Wrapper)
- (for [@.jvm (..host_phase (list))
- @.ruby (|>>)])))
+ (for @.jvm (..host_phase (list))
+ @.ruby (|>>))))
(def: platform
(IO (Platform Register _.Expression _.Statement))