From a62ce3f9c2b605e0033f4772b0f64c4525de4d86 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 11 Aug 2021 02:38:59 -0400 Subject: Relocated maybe and lazy from data to control. --- lux-jvm/source/luxc/lang/directive/jvm.lux | 4 +-- lux-jvm/source/luxc/lang/host/jvm/inst.lux | 8 ++--- lux-jvm/source/luxc/lang/translation/jvm.lux | 38 +++++++++++----------- .../source/luxc/lang/translation/jvm/common.lux | 2 +- .../luxc/lang/translation/jvm/extension/common.lux | 2 +- .../luxc/lang/translation/jvm/extension/host.lux | 2 +- .../source/luxc/lang/translation/jvm/function.lux | 8 ++--- 7 files changed, 32 insertions(+), 32 deletions(-) (limited to 'lux-jvm/source') diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index 8a06289da..fa8b1420e 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -586,7 +586,7 @@ (-> Text ..Phase Archive i (..Operation Requirements))] ..Handler)) (function (_ extension_name phase archive input) - (case (.run parser input) + (case (.result parser input) (#try.Success input') (handler extension_name phase archive input') @@ -601,7 +601,7 @@ (Parser ) (do {! <>.monad} [raw .text] - (<>.lift (.run raw))))] + (<>.lift (.result raw))))] [class_declaration Declaration parser.declaration'] [class (Type Class) parser.class] diff --git a/lux-jvm/source/luxc/lang/host/jvm/inst.lux b/lux-jvm/source/luxc/lang/host/jvm/inst.lux index f7a8e6b18..7229babab 100644 --- a/lux-jvm/source/luxc/lang/host/jvm/inst.lux +++ b/lux-jvm/source/luxc/lang/host/jvm/inst.lux @@ -6,12 +6,12 @@ [monad (#+ do)]] [control ["." function] + ["." maybe] ["." try] ["p" parser ["s" code]]] [data ["." product] - ["." maybe] [collection ["." list ("#@." functor)]]] [macro @@ -367,9 +367,9 @@ (def: .public (LOOKUPSWITCH default keys+labels) (-> //.Label (List [Int //.Label]) Inst) (function (_ visitor) - (let [keys+labels (list.sort (function (_ left right) - (i.< (product.left left) (product.left right))) - keys+labels) + (let [keys+labels (list.sorted (function (_ left right) + (i.< (product.left left) (product.left right))) + keys+labels) array_size (list.size keys+labels) keys_array (ffi.array int array_size) labels_array (ffi.array org/objectweb/asm/Label array_size) diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index 46242abc7..dbf49b552 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -6,6 +6,7 @@ [monad (#+ do)]] [control pipe + ["." maybe] ["." try (#+ Try)] ["." exception (#+ exception:)] ["." io (#+ IO io)] @@ -14,7 +15,6 @@ [data [binary (#+ Binary)] ["." product] - ["." maybe] ["." text ("#@." hash) ["%" format (#+ format)]] [collection @@ -126,25 +126,25 @@ (|>> valueI (inst.PUTSTATIC (type.class bytecode_name (list)) ..value_field ..$Value) inst.RETURN))))] - (io.run (do (try.with io.monad) - [_ (loader.store eval_class bytecode library) - class (loader.load eval_class loader) - value (\ io.monad in (..class_value eval_class class))] - (in [value - [eval_class bytecode]]))))) + (io.run! (do (try.with io.monad) + [_ (loader.store eval_class bytecode library) + class (loader.load eval_class loader) + value (\ io.monad in (..class_value eval_class class))] + (in [value + [eval_class bytecode]]))))) (def: (execute! library loader [class_name class_bytecode]) (-> Library java/lang/ClassLoader Definition (Try Any)) - (io.run (do (try.with io.monad) - [existing_class? (|> (atom.read library) - (\ io.monad map (function (_ library) - (dictionary.key? library class_name))) - (try.lifted io.monad) - (: (IO (Try Bit)))) - _ (if existing_class? - (in []) - (loader.store class_name class_bytecode library))] - (loader.load class_name loader)))) + (io.run! (do (try.with io.monad) + [existing_class? (|> (atom.read library) + (\ io.monad map (function (_ library) + (dictionary.key? library class_name))) + (try.lifted io.monad) + (: (IO (Try Bit)))) + _ (if existing_class? + (in []) + (loader.store class_name class_bytecode library))] + (loader.load class_name loader)))) (def: (define! library loader context custom valueI) (-> Library java/lang/ClassLoader generation.Context (Maybe Text) Inst (Try [Text Any Definition])) @@ -175,11 +175,11 @@ [(..class_name context) bytecode]) (def: (re_learn context custom [_ bytecode]) - (io.run + (io.run! (loader.store (maybe.else (..class_name context) custom) bytecode library))) (def: (re_load context custom [directive_name bytecode]) - (io.run + (io.run! (do (try.with io.monad) [.let [class_name (maybe.else (..class_name context) custom)] diff --git a/lux-jvm/source/luxc/lang/translation/jvm/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/common.lux index 283081608..b6bba249f 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/common.lux @@ -53,7 +53,7 @@ ... (function (_ (^@ def-name [def-module def-name]) def-bytecode) ... (let [normal-name (format (name.normalize def-name) (%n (text/hash def-name))) ... class-name (format (text.replace-all "/" "." def-module) "." normal-name)] -... (<| (macro.run state) +... (<| (macro.result state) ... (do macro.monad ... [_ (..store-class class-name def-bytecode) ... class (..load-class class-name)] diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux index 14d31d4e2..eaee3b51e 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux @@ -47,7 +47,7 @@ (-> Text Phase Archive s (Operation Inst))] Handler)) (function (_ extension_name phase archive input) - (case (.run parser input) + (case (.result parser input) (#try.Success input') (handler extension_name phase archive input') diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux index 2d94e822c..6fc52a0ab 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -5,6 +5,7 @@ [abstract ["." monad (#+ do)]] [control + ["." maybe ("#\." functor)] ["." exception (#+ exception:)] ["." function] ["<>" parser ("#\." monad) @@ -12,7 +13,6 @@ ["<.>" synthesis (#+ Parser)]]] [data ["." product] - ["." maybe ("#\." functor)] ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux index b39157480..dfca4a6e6 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux @@ -345,11 +345,11 @@ [functionI (generate archive functionS) argsI (monad.map @ (generate archive) argsS) .let [applyI (|> argsI - (list.chunk //runtime.num_apply_variants) - (list@map (.function (_ chunkI+) + (list.sub //runtime.num_apply_variants) + (list@map (.function (_ subI+) (|>> (_.CHECKCAST //.$Function) - (_.fuse chunkI+) - (_.INVOKEVIRTUAL //.$Function //runtime.apply_method (//runtime.apply_signature (list.size chunkI+)))))) + (_.fuse subI+) + (_.INVOKEVIRTUAL //.$Function //runtime.apply_method (//runtime.apply_signature (list.size subI+)))))) _.fuse)]] (in (|>> functionI applyI)))) -- cgit v1.2.3