diff options
Diffstat (limited to 'lux-jvm/source/luxc/lang/translation/jvm/extension')
-rw-r--r-- | lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux | 28 | ||||
-rw-r--r-- | lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux | 154 |
2 files changed, 91 insertions, 91 deletions
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 eaee3b51e..96fdefe31 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux @@ -100,22 +100,22 @@ elseG (phase archive else) conditionalsG+ (: (Operation (List [(List [Int Label]) Inst])) - (monad.map @ (function (_ [chars branch]) - (do @ - [branchG (phase archive branch)] - (in (<| _.with_label (function (_ @branch)) - [(list@map (function (_ char) - [(.int char) @branch]) - chars) - (|>> (_.label @branch) - branchG - (_.GOTO @end))])))) - conditionals)) + (monad.each @ (function (_ [chars branch]) + (do @ + [branchG (phase archive branch)] + (in (<| _.with_label (function (_ @branch)) + [(list@each (function (_ char) + [(.int char) @branch]) + chars) + (|>> (_.label @branch) + branchG + (_.GOTO @end))])))) + conditionals)) .let [table (|> conditionalsG+ - (list@map product.left) - list@join) + (list@each product.left) + list@conjoint) conditionalsG (|> conditionalsG+ - (list@map product.right) + (list@each product.right) _.fuse)]] (in (|>> inputG (_.unwrap type.long) _.L2I (_.LOOKUPSWITCH @else table) 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 e2855e999..826c45f1a 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -734,9 +734,9 @@ [($_ <>.and ..class <synthesis>.text ..return (<>.some ..input)) (function (_ extension_name generate archive [class method outputT inputsTS]) (do {! phase.monad} - [inputsTI (monad.map ! (generate_input generate archive) inputsTS)] - (in (|>> (_.fuse (list\map product.right inputsTI)) - (_.INVOKESTATIC class method (type.method [(list) (list\map product.left inputsTI) outputT (list)])) + [inputsTI (monad.each ! (generate_input generate archive) inputsTS)] + (in (|>> (_.fuse (list\each product.right inputsTI)) + (_.INVOKESTATIC class method (type.method [(list) (list\each product.left inputsTI) outputT (list)])) (prepare_output outputT)))))])) (template [<name> <invoke>] @@ -747,13 +747,13 @@ (function (_ extension_name generate archive [class method outputT objectS inputsTS]) (do {! phase.monad} [objectI (generate archive objectS) - inputsTI (monad.map ! (generate_input generate archive) inputsTS)] + inputsTI (monad.each ! (generate_input generate archive) inputsTS)] (in (|>> objectI (_.CHECKCAST class) - (_.fuse (list\map product.right inputsTI)) + (_.fuse (list\each product.right inputsTI)) (<invoke> class method (type.method [(list) - (list\map product.left inputsTI) + (list\each product.left inputsTI) outputT (list)])) (prepare_output outputT)))))]))] @@ -769,11 +769,11 @@ [($_ <>.and ..class (<>.some ..input)) (function (_ extension_name generate archive [class inputsTS]) (do {! phase.monad} - [inputsTI (monad.map ! (generate_input generate archive) inputsTS)] + [inputsTI (monad.each ! (generate_input generate archive) inputsTS)] (in (|>> (_.NEW class) _.DUP - (_.fuse (list\map product.right inputsTI)) - (_.INVOKESPECIAL class "<init>" (type.method [(list) (list\map product.left inputsTI) type.void (list)]))))))])) + (_.fuse (list\each product.right inputsTI)) + (_.INVOKESPECIAL class "<init>" (type.method [(list) (list\each product.left inputsTI) type.void (list)]))))))])) (def: member_bundle Bundle @@ -886,14 +886,14 @@ [#synthesis.Access]) (#synthesis.Bit_Fork when then else) - (#synthesis.Bit_Fork when (recur then) (maybe\map recur else)) + (#synthesis.Bit_Fork when (recur then) (maybe\each recur else)) (^template [<tag>] [(<tag> [[test then] elses]) (<tag> [[test (recur then)] - (list\map (function (_ [else_test else_then]) - [else_test (recur else_then)]) - elses)])]) + (list\each (function (_ [else_test else_then]) + [else_test (recur else_then)]) + elses)])]) ([#synthesis.I64_Fork] [#synthesis.F64_Fork] [#synthesis.Text_Fork]) @@ -913,7 +913,7 @@ (synthesis.variant [lefts right? (recur sub)]) (^ (synthesis.tuple members)) - (synthesis.tuple (list\map recur members)) + (synthesis.tuple (list\each recur members)) (^ (synthesis.variable var)) (|> mapping @@ -934,31 +934,31 @@ (synthesis.branch/get [path (recur recordS)]) (^ (synthesis.loop/scope [offset initsS+ bodyS])) - (synthesis.loop/scope [offset (list\map recur initsS+) (recur bodyS)]) + (synthesis.loop/scope [offset (list\each recur initsS+) (recur bodyS)]) (^ (synthesis.loop/recur updatesS+)) - (synthesis.loop/recur (list\map recur updatesS+)) + (synthesis.loop/recur (list\each recur updatesS+)) (^ (synthesis.function/abstraction [environment arity bodyS])) - (synthesis.function/abstraction [(list\map (function (_ captured) - (case captured - (^ (synthesis.variable var)) - (|> mapping - (dictionary.value captured) - (maybe.else var) - synthesis.variable) - - _ - captured)) - environment) + (synthesis.function/abstraction [(list\each (function (_ captured) + (case captured + (^ (synthesis.variable var)) + (|> mapping + (dictionary.value captured) + (maybe.else var) + synthesis.variable) + + _ + captured)) + environment) arity bodyS]) (^ (synthesis.function/apply [functionS inputsS+])) - (synthesis.function/apply [(recur functionS) (list\map recur inputsS+)]) + (synthesis.function/apply [(recur functionS) (list\each recur inputsS+)]) (#synthesis.Extension [name inputsS+]) - (#synthesis.Extension [name (list\map recur inputsS+)])))) + (#synthesis.Extension [name (list\each recur inputsS+)])))) (def: $Object (type.class "java.lang.Object" (list))) @@ -975,22 +975,22 @@ (let [store_capturedI (|> env list.size list.indices - (list\map (.function (_ register) - (|>> (_.ALOAD 0) - (_.ALOAD (++ register)) - (_.PUTFIELD class (///reference.foreign_name register) $Object)))) + (list\each (.function (_ register) + (|>> (_.ALOAD 0) + (_.ALOAD (++ register)) + (_.PUTFIELD class (///reference.foreign_name register) $Object)))) _.fuse)] (_def.method #$.Public $.noneM "<init>" (anonymous_init_method env) (|>> (_.ALOAD 0) - ((_.fuse (list\map product.right inputsTI))) - (_.INVOKESPECIAL super_class "<init>" (type.method [(list) (list\map product.left inputsTI) type.void (list)])) + ((_.fuse (list\each product.right inputsTI))) + (_.INVOKESPECIAL super_class "<init>" (type.method [(list) (list\each product.left inputsTI) type.void (list)])) store_capturedI _.RETURN)))) (def: (anonymous_instance generate archive class env) (-> Phase Archive (Type Class) (Environment Synthesis) (Operation Inst)) (do {! phase.monad} - [captureI+ (monad.map ! (generate archive) env)] + [captureI+ (monad.each ! (generate archive) env)] (in (|>> (_.NEW class) _.DUP (_.fuse captureI+) @@ -1092,56 +1092,56 @@ class (type.class anonymous_class_name (list)) total_environment (|> overriden_methods ... Get all the environments. - (list\map product.left) + (list\each product.left) ... Combine them. - list\join + list\conjoint ... Remove duplicates. (set.of_list synthesis.hash) set.list) global_mapping (|> total_environment ... Give them names as "foreign" variables. list.enumeration - (list\map (function (_ [id capture]) - [capture (#variable.Foreign id)])) + (list\each (function (_ [id capture]) + [capture (#variable.Foreign id)])) (dictionary.of_list synthesis.hash)) - normalized_methods (list\map (function (_ [environment - [ownerT name - strict_fp? annotations vars - self_name arguments returnT exceptionsT - body]]) - (let [local_mapping (|> environment - list.enumeration - (list\map (function (_ [foreign_id capture]) - [(synthesis.variable/foreign foreign_id) - (|> global_mapping - (dictionary.value capture) - maybe.trusted)])) - (dictionary.of_list synthesis.hash))] - [ownerT name - strict_fp? annotations vars - self_name arguments returnT exceptionsT - (normalize_method_body local_mapping body)])) - overriden_methods)] - inputsTI (monad.map ! (generate_input generate archive) inputsTS) + normalized_methods (list\each (function (_ [environment + [ownerT name + strict_fp? annotations vars + self_name arguments returnT exceptionsT + body]]) + (let [local_mapping (|> environment + list.enumeration + (list\each (function (_ [foreign_id capture]) + [(synthesis.variable/foreign foreign_id) + (|> global_mapping + (dictionary.value capture) + maybe.trusted)])) + (dictionary.of_list synthesis.hash))] + [ownerT name + strict_fp? annotations vars + self_name arguments returnT exceptionsT + (normalize_method_body local_mapping body)])) + overriden_methods)] + inputsTI (monad.each ! (generate_input generate archive) inputsTS) method_definitions (|> normalized_methods - (monad.map ! (function (_ [ownerT name - strict_fp? annotations varsT - self_name arguments returnT exceptionsT - bodyS]) - (do ! - [bodyG (generation.with_context artifact_id - (generate archive bodyS)) - .let [argumentsT (list\map product.right arguments)]] - (in (_def.method #$.Public - (if strict_fp? - ($_ $.++M $.finalM $.strictM) - $.finalM) - name - (type.method [varsT argumentsT returnT exceptionsT]) - (|>> (prepare_arguments 1 argumentsT) - bodyG - (returnI returnT))))))) - (\ ! map _def.fuse)) + (monad.each ! (function (_ [ownerT name + strict_fp? annotations varsT + self_name arguments returnT exceptionsT + bodyS]) + (do ! + [bodyG (generation.with_context artifact_id + (generate archive bodyS)) + .let [argumentsT (list\each product.right arguments)]] + (in (_def.method #$.Public + (if strict_fp? + ($_ $.++M $.finalM $.strictM) + $.finalM) + name + (type.method [varsT argumentsT returnT exceptionsT]) + (|>> (prepare_arguments 1 argumentsT) + bodyG + (returnI returnT))))))) + (\ ! each _def.fuse)) .let [directive [anonymous_class_name (_def.class #$.V1_6 #$.Public $.finalC anonymous_class_name (list) |