diff options
author | Eduardo Julian | 2021-09-08 23:14:59 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-09-08 23:14:59 -0400 |
commit | 085c9a6ef151531cb01b842ed2f4366a49b78367 (patch) | |
tree | 01d5671061f1c688fe74319196f8da0e8aa95e4c /lux-js/source | |
parent | 54ab659064990ff37a9234c9792102a3b88277d6 (diff) |
De-bracing | part 2
Diffstat (limited to 'lux-js/source')
-rw-r--r-- | lux-js/source/program.lux | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index 06d718f14..1e36e2906 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -75,7 +75,7 @@ #.None "???")) -(for {@.old +(for [@.old (as_is (import: java/lang/String) (import: (java/lang/Class a)) @@ -160,7 +160,7 @@ (-> Int org/openjdk/nashorn/api/scripting/JSObject) (ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject [program/IntValue] [] - ... Methods +... Methods (program/IntValue [] (getValue self []) java/lang/Object (:as java/lang/Object value)) @@ -221,11 +221,11 @@ (#.Some sub_value) (|> sub_value (:as Int) js_int) #.None) - ... else +... else (:as org/openjdk/nashorn/api/scripting/JSObject sub_value))))] (ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject [program/StructureValue] [] - ... Methods +... Methods (program/StructureValue [] (getValue self []) java/lang/Object (:as (Array java/lang/Object) value)) @@ -401,12 +401,12 @@ #.None (if (org/openjdk/nashorn/api/scripting/JSObject::isFunction js_object) (#try.Success js_object) - ... (exception.except ..unknown_kind_of_host_object [(:as java/lang/Object js_object)]) +... (exception.except ..unknown_kind_of_host_object [(:as java/lang/Object js_object)]) (#try.Success js_object) )))) #.None) - ... else - ... (exception.except ..unknown_kind_of_host_object [(:as java/lang/Object js_object)]) +... else +... (exception.except ..unknown_kind_of_host_object [(:as java/lang/Object js_object)]) (#try.Success js_object) ))) @@ -422,9 +422,9 @@ ) @.js - (as_is)}) + (as_is)]) -(for {@.old +(for [@.old (as_is (def: (call_macro inputs lux macro) (-> (List Code) Lux org/openjdk/nashorn/api/scripting/JSObject (Try (Try [Lux (List Code)]))) (let [to_js (: (-> Any java/lang/Object) @@ -463,9 +463,9 @@ (def: (expander macro inputs lux) Expander (#try.Success ((:as Macro' macro) inputs lux))) - }) + ]) -(for {@.old +(for [@.old (as_is (def: (evaluate! interpreter alias input) (-> javax/script/ScriptEngine Context _.Expression (Try Any)) (do try.monad @@ -519,9 +519,9 @@ @.js (as_is (def: (eval code) (-> Text (Try (Maybe Any))) - ... 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";. +... 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) #.None @@ -573,28 +573,28 @@ (do try.monad [_ (..execute! content)] (..evaluate! context (_.var (reference.artifact context))))))))) - )}) + )]) (def: (phase_wrapper archive) (-> Archive (runtime.Operation phase.Wrapper)) (do phase.monad [] (in (:as phase.Wrapper - (for {... The implementation for @.old is technically incorrect. + (for [ ... The implementation for @.old is technically incorrect. ... However, the JS compiler runs fast enough on Node to be fully hosted there. ... And running the JS compiler on the JVM (on top of Nashorn) is impractically slow. ... This means that in practice, only the @.js implementation matters. ... And since no cross-language boundary needs to be handled, it's a correct implementation. @.old (|>>) - @.js (|>>)}))))) + @.js (|>>)]))))) (def: platform (IO (Platform [Register Text] _.Expression _.Statement)) (do io.monad [host ..host] - (in [#platform.&file_system (for {@.old (file.async file.default) + (in [#platform.&file_system (for [@.old (file.async file.default) @.jvm (file.async file.default) - @.js file.default}) + @.js file.default]) #platform.host host #platform.phase js.generate #platform.runtime runtime.generate @@ -618,7 +618,7 @@ no_inputs))) (_.string ""))))) -(for {@.old +(for [@.old (def: (extender phase_wrapper) (-> phase.Wrapper Extender) ... TODO: Stop relying on coercions ASAP. @@ -651,7 +651,7 @@ @.js (def: (extender phase_wrapper handler) (-> phase.Wrapper Extender) - (:expected handler))}) + (:expected handler))]) (def: (declare_success! _) (-> Any (Async Any)) |