aboutsummaryrefslogtreecommitdiff
path: root/lux-python
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lux-python/source/program.lux32
1 files changed, 15 insertions, 17 deletions
diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux
index aac58040c..82f82733b 100644
--- a/lux-python/source/program.lux
+++ b/lux-python/source/program.lux
@@ -48,7 +48,6 @@
[macro (.only Expander)]]
[phase
["[0]" extension (.only Extender Handler)
- ["[1]/[0]" bundle]
["[0]" analysis
["[1]" python]]
["[0]" translation
@@ -466,7 +465,7 @@
(..eval [(_.code input) globals])))
execute! (is (-> (_.Statement Any) (Try Any))
(function (execute! input)
- (ffi.try ("python exec" (_.code input) globals))))
+ (ffi.try (.python_exec# (_.code input) globals))))
define! (is (-> unit.ID (_.Expression Any) (Try [Text Any (_.Statement Any)]))
(function (define! context input)
(let [global (reference.artifact context)
@@ -492,6 +491,10 @@
[_ (execute! content)]
(evaluate! context (_.var (reference.artifact context)))))))))))))
+(def phase_wrapper
+ phase.Wrapper
+ (..pseudo_function ..to_host))
+
(with_expansions [<jvm> (these (def extender
Extender
... TODO: Stop relying on coercions ASAP.
@@ -508,25 +511,20 @@
(as Try)
(do try.monad
[handler (try.of_maybe (..python_function! handler))
- output (org/python/core/PyFunction::__call__ (|> (ffi.array org/python/core/PyObject 5)
- (ffi.write! 0 (as org/python/core/PyObject (org/python/core/PyString::new (ffi.as_string name))))
- (ffi.write! 1 (as org/python/core/PyObject (phase_wrapper phase)))
- (ffi.write! 2 (..to_host archive))
- (ffi.write! 3 (..to_host parameters))
- (ffi.write! 4 (..to_host state)))
+ output (org/python/core/PyFunction::__call__ (|> (ffi.array org/python/core/PyObject 4)
+ (ffi.write! 0 (as org/python/core/PyObject (phase_wrapper phase)))
+ (ffi.write! 1 (..to_host archive))
+ (ffi.write! 2 (..to_host parameters))
+ (ffi.write! 3 (..to_host state)))
handler)]
(..read output)))))]
(for @.old (these <jvm>)
@.jvm (these <jvm>)
@.python
- (def (extender phase_wrapper handler)
- (-> phase.Wrapper Extender)
- (as_expected handler))))
-
-(def phase_wrapper
- phase.Wrapper
- (..pseudo_function ..to_host))
+ (def extender
+ Extender
+ (|>> as_expected))))
(def platform
(IO (Platform Register (_.Expression Any) (_.Statement Any)))
@@ -534,7 +532,7 @@
[host ..host]
(in [platform.#file_system (file.async file.default)
platform.#host host
- platform.#phase python.translate
+ platform.#phase python.expression
platform.#runtime runtime.translate
platform.#phase_wrapper ..phase_wrapper
platform.#write (|>> _.code (at utf8.codec encoded))])))
@@ -588,7 +586,7 @@
analysis.bundle
..platform
translation.bundle
- extension/bundle.empty
+ extension.empty
..lux_program
(reference.constant python/reference.system)
..extender