From c7f67a85f980db2dab2e2d7df4168af83e9013a8 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 29 Nov 2022 18:48:42 -0400 Subject: Added money-handling machinery. --- lux-js/source/program.lux | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'lux-js/source') diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index f7729ec2e..022029702 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -48,7 +48,6 @@ [macro (.only Expander)]] [phase ["[0]" extension (.only Extender Handler) - ["[1]/[0]" bundle] ["[0]" analysis ["[1]" js]] ["[0]" translation @@ -574,8 +573,8 @@ ... Note: I have to call "eval" this way ... in order to avoid a quirk of calling eval in Node ... when the code is running under "use strict";. - (try (let [return ("js apply" (function.identity ("js constant" "eval")) [code])] - (if ("js object null?" return) + (try (let [return (.js_apply# (function.identity (.js_constant# "eval")) [code])] + (if (.js_object_null?# return) {.#None} {.#Some return})))) @@ -650,7 +649,7 @@ ... This would crash if the compiler was run on a browser. @.js (maybe.trusted file.default)) platform.#host host - platform.#phase js.translate + platform.#phase js.expression platform.#runtime runtime.translate platform.#phase_wrapper ..phase_wrapper platform.#write (|>> _.code (at utf8.codec encoded))]))) @@ -692,20 +691,19 @@ .let [to_js (is (-> Any java/lang/Object) (|>> (as (Array java/lang/Object)) js_structure (as java/lang/Object)))] output (org/openjdk/nashorn/api/scripting/JSObject::call {.#None} - (|> (array.empty 5) + (|> (array.empty 4) (is (Array java/lang/Object)) - (array.has! 0 name) - (array.has! 1 (as java/lang/Object (extender phase))) - (array.has! 2 (to_js archive)) - (array.has! 3 (to_js parameters)) - (array.has! 4 (to_js state))) + (array.has! 0 (as java/lang/Object ..phase_wrapper)) + (array.has! 1 (to_js archive)) + (array.has! 2 (to_js parameters)) + (array.has! 3 (to_js state))) handler)] (lux_object (as java/lang/Object output))))) @.js - (def (extender phase_wrapper handler) - (-> phase.Wrapper Extender) - (as_expected handler))) + (def extender + Extender + (|>> as_expected))) (def (declare_success! _) (-> Any (Async Any)) @@ -732,7 +730,7 @@ analysis.bundle (io.io platform) translation.bundle - extension/bundle.empty + extension.empty ..lux_program (reference.constant js/reference.system) ..extender -- cgit v1.2.3