From 8059ba6c421d3094fba336ac5d3dd39fe984b05e Mon Sep 17 00:00:00 2001
From: Eduardo Julian
Date: Mon, 28 Nov 2022 15:35:57 -0400
Subject: Added currencies.

---
 lux-ruby/source/program.lux | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

(limited to 'lux-ruby/source')

diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux
index a16ad4dbd..df6454e1c 100644
--- a/lux-ruby/source/program.lux
+++ b/lux-ruby/source/program.lux
@@ -45,7 +45,6 @@
         [macro (.only Expander)]]
        [phase
         ["[0]" extension (.only Extender Handler)
-         ["[1]/[0]" bundle]
          ["[0]" analysis
           ["[1]" ruby]]
          ["[0]" translation
@@ -778,11 +777,6 @@
                  [_ (run! content)]
                  (run! (_.global (reference.artifact context))))))))))
 
-(def phase_wrapper
-  phase.Wrapper
-  (for @.jvm (..host_phase (list))
-       @.ruby (|>>)))
-
 (for @.jvm (these (exception.def .public (invaid_phase_application [partial_application arity])
                     (Exception [(List Any) (List Any)])
                     (exception.report
@@ -847,7 +841,7 @@
 
                   (def (host_phase partial_application phase)
                     (All (_ s i o)
-                      (-> (List Any) (Phase [extension.Bundle s] i o)
+                      (-> (List Any) (Phase s i o)
                           org/jruby/RubyProc))
                     (let [block (ffi.object [] org/jruby/runtime/Block []
                                   [org/jruby/runtime/BlockBody ..phase_block_body]
@@ -928,6 +922,11 @@
                                          (exception.except ..invaid_phase_application [partial_application inputs])))))]
                       (org/jruby/RubyProc::newProc (!ruby_runtime) block ..proc_type)))
 
+                  (def phase_wrapper
+                    phase.Wrapper
+                    (for @.jvm (..host_phase (list))
+                         @.ruby (|>>)))
+
                   (def extender
                     Extender
                     ... TODO: Stop relying on coercions ASAP.
@@ -945,20 +944,18 @@
                         (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.is 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)))
+                                                            (|> (ffi.array org/jruby/runtime/builtin/IRubyObject 4)
+                                                                (ffi.write! 0 (as org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase)))
+                                                                (ffi.write! 1 (..to_host archive))
+                                                                (ffi.write! 2 (..to_host parameters))
+                                                                (ffi.write! 3 (..to_host state)))
                                                             handler)]
                           (..read (ffi.is java/lang/Object output))))))
 
      @.ruby
-     (def (extender phase_wrapper handler)
-       (-> phase.Wrapper Extender)
-       (as_expected handler)))
+     (def extender
+       Extender
+       (|>> as_expected)))
 
 (def platform
   (IO (Platform Register _.Expression _.Statement))
@@ -966,7 +963,7 @@
     [host ..host]
     (in [platform.#file_system (file.async file.default)
          platform.#host host
-         platform.#phase ruby.translate
+         platform.#phase ruby.expression
          platform.#runtime runtime.translate
          platform.#phase_wrapper ..phase_wrapper
          platform.#write (|>> _.code (at utf8.codec encoded))])))
@@ -1002,7 +999,7 @@
                        analysis.bundle
                        ..platform
                        translation.bundle
-                       extension/bundle.empty
+                       extension.empty
                        ..lux_program
                        (reference.constant ruby/reference.system)
                        ..extender
-- 
cgit v1.2.3