From 36303d6cb2ce3ab9e36d045b9516c997bd461862 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 24 Aug 2021 05:23:45 -0400 Subject: Outsourced the syntax for labelled type definitions to macros. --- lux-jvm/source/luxc/lang/translation/jvm.lux | 6 +- .../luxc/lang/translation/jvm/extension/common.lux | 28 ++-- .../luxc/lang/translation/jvm/extension/host.lux | 154 ++++++++++----------- .../source/luxc/lang/translation/jvm/function.lux | 142 +++++++++---------- lux-jvm/source/luxc/lang/translation/jvm/loop.lux | 36 ++--- .../source/luxc/lang/translation/jvm/reference.lux | 4 +- .../source/luxc/lang/translation/jvm/runtime.lux | 22 +-- .../source/luxc/lang/translation/jvm/structure.lux | 16 +-- 8 files changed, 204 insertions(+), 204 deletions(-) (limited to 'lux-jvm/source/luxc/lang/translation') diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index 71dcfa645..18c05fecc 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -137,8 +137,8 @@ (-> 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))) + (\ io.monad each (function (_ library) + (dictionary.key? library class_name))) (try.lifted io.monad) (: (IO (Try Bit)))) _ (if existing_class? @@ -162,7 +162,7 @@ (: Host (implementation (def: (evaluate! context valueI) - (\ try.monad map product.left + (\ try.monad each product.left (..evaluate! library loader context valueI))) (def: execute! 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 .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 [ ] @@ -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)) ( 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 "" (type.method [(list) (list\map product.left inputsTI) type.void (list)]))))))])) + (_.fuse (list\each product.right inputsTI)) + (_.INVOKESPECIAL class "" (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 [] [( [[test then] elses]) ( [[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 "" (anonymous_init_method env) (|>> (_.ALOAD 0) - ((_.fuse (list\map product.right inputsTI))) - (_.INVOKESPECIAL super_class "" (type.method [(list) (list\map product.left inputsTI) type.void (list)])) + ((_.fuse (list\each product.right inputsTI))) + (_.INVOKESPECIAL super_class "" (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) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux index 0508e9c62..df80c6088 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux @@ -81,7 +81,7 @@ (def: (inputsI start amount) (-> Register Nat Inst) (|> (enum.range n.enum start (n.+ start (-- amount))) - (list@map _.ALOAD) + (list@each _.ALOAD) _.fuse)) (def: (applysI start amount) @@ -109,7 +109,7 @@ (def: (instance generate archive class arity env) (-> Phase Archive (Type Class) Arity (Environment Synthesis) (Operation Inst)) (do {@ phase.monad} - [captureI+ (monad.map @ (generate archive) env) + [captureI+ (monad.each @ (generate archive) env) .let [argsI (if (poly_arg? arity) (|> (nullsI (-- arity)) (list (_.int +0)) @@ -133,9 +133,9 @@ captureI (|> (case env_size 0 (list) _ (enum.range n.enum 0 (-- env_size))) - (list@map (.function (_ source) - (|>> (_.ALOAD 0) - (_.GETFIELD class (reference.foreign_name source) //.$Value)))) + (list@each (.function (_ source) + (|>> (_.ALOAD 0) + (_.GETFIELD class (reference.foreign_name source) //.$Value)))) _.fuse) argsI (|> (nullsI (-- arity)) (list (_.int +0)) @@ -175,18 +175,18 @@ store_capturedI (|> (case env_size 0 (list) _ (enum.range n.enum 0 (-- env_size))) - (list@map (.function (_ register) - (|>> (_.ALOAD 0) - (_.ALOAD (++ register)) - (_.PUTFIELD class (reference.foreign_name register) //.$Value)))) + (list@each (.function (_ register) + (|>> (_.ALOAD 0) + (_.ALOAD (++ register)) + (_.PUTFIELD class (reference.foreign_name register) //.$Value)))) _.fuse) store_partialI (if (poly_arg? arity) (|> (enum.range n.enum 0 (n.- 2 arity)) - (list@map (.function (_ idx) - (let [register (offset_partial idx)] - (|>> (_.ALOAD 0) - (_.ALOAD (++ register)) - (_.PUTFIELD class (reference.partial_name idx) //.$Value))))) + (list@each (.function (_ idx) + (let [register (offset_partial idx)] + (|>> (_.ALOAD 0) + (_.ALOAD (++ register)) + (_.PUTFIELD class (reference.partial_name idx) //.$Value))))) _.fuse) function.identity)] (def.method #$.Public $.noneM "" (init_method env arity) @@ -201,57 +201,57 @@ Def) (let [num_partials (-- function_arity) @default ($.new_label []) - @labels (list@map $.new_label (list.repeated num_partials [])) + @labels (list@each $.new_label (list.repeated num_partials [])) over_extent (|> (.int function_arity) (i.- (.int apply_arity))) - casesI (|> (list@compose @labels (list @default)) + casesI (|> (list@composite @labels (list @default)) (list.zipped/2 (enum.range n.enum 0 num_partials)) - (list@map (.function (_ [stage @label]) - (let [load_partialsI (if (n.> 0 stage) - (|> (enum.range n.enum 0 (-- stage)) - (list@map (|>> reference.partial_name (load_fieldI class))) - _.fuse) - function.identity)] - (cond (i.= over_extent (.int stage)) - (|>> (_.label @label) - (_.ALOAD 0) - (when> [(new> (n.> 0 stage) [])] - [(_.INVOKEVIRTUAL class "reset" (reset_method class))]) - load_partialsI - (inputsI 1 apply_arity) - (_.INVOKEVIRTUAL class "impl" (implementation_method function_arity)) - _.ARETURN) + (list@each (.function (_ [stage @label]) + (let [load_partialsI (if (n.> 0 stage) + (|> (enum.range n.enum 0 (-- stage)) + (list@each (|>> reference.partial_name (load_fieldI class))) + _.fuse) + function.identity)] + (cond (i.= over_extent (.int stage)) + (|>> (_.label @label) + (_.ALOAD 0) + (when> [(new> (n.> 0 stage) [])] + [(_.INVOKEVIRTUAL class "reset" (reset_method class))]) + load_partialsI + (inputsI 1 apply_arity) + (_.INVOKEVIRTUAL class "impl" (implementation_method function_arity)) + _.ARETURN) - (i.> over_extent (.int stage)) - (let [args_to_completion (|> function_arity (n.- stage)) - args_left (|> apply_arity (n.- args_to_completion))] - (|>> (_.label @label) - (_.ALOAD 0) - (_.INVOKEVIRTUAL class "reset" (reset_method class)) - load_partialsI - (inputsI 1 args_to_completion) - (_.INVOKEVIRTUAL class "impl" (implementation_method function_arity)) - (applysI (++ args_to_completion) args_left) - _.ARETURN)) + (i.> over_extent (.int stage)) + (let [args_to_completion (|> function_arity (n.- stage)) + args_left (|> apply_arity (n.- args_to_completion))] + (|>> (_.label @label) + (_.ALOAD 0) + (_.INVOKEVIRTUAL class "reset" (reset_method class)) + load_partialsI + (inputsI 1 args_to_completion) + (_.INVOKEVIRTUAL class "impl" (implementation_method function_arity)) + (applysI (++ args_to_completion) args_left) + _.ARETURN)) - ... (i.< over_extent (.int stage)) - (let [env_size (list.size env) - load_capturedI (|> (case env_size - 0 (list) - _ (enum.range n.enum 0 (-- env_size))) - (list@map (|>> reference.foreign_name (load_fieldI class))) - _.fuse)] - (|>> (_.label @label) - (_.NEW class) - _.DUP - load_capturedI - get_amount_of_partialsI - (inc_intI apply_arity) - load_partialsI - (inputsI 1 apply_arity) - (nullsI (|> num_partials (n.- apply_arity) (n.- stage))) - (_.INVOKESPECIAL class "" (init_method env function_arity)) - _.ARETURN)) - )))) + ... (i.< over_extent (.int stage)) + (let [env_size (list.size env) + load_capturedI (|> (case env_size + 0 (list) + _ (enum.range n.enum 0 (-- env_size))) + (list@each (|>> reference.foreign_name (load_fieldI class))) + _.fuse)] + (|>> (_.label @label) + (_.NEW class) + _.DUP + load_capturedI + get_amount_of_partialsI + (inc_intI apply_arity) + load_partialsI + (inputsI 1 apply_arity) + (nullsI (|> num_partials (n.- apply_arity) (n.- stage))) + (_.INVOKESPECIAL class "" (init_method env function_arity)) + _.ARETURN)) + )))) _.fuse)] (def.method #$.Public $.noneM //runtime.apply_method (//runtime.apply_signature apply_arity) (|>> get_amount_of_partialsI @@ -263,16 +263,16 @@ (def: .public with_environment (-> (Environment Synthesis) Def) (|>> list.enumeration - (list@map (.function (_ [env_idx env_source]) - (def.field #$.Private $.finalF (reference.foreign_name env_idx) //.$Value))) + (list@each (.function (_ [env_idx env_source]) + (def.field #$.Private $.finalF (reference.foreign_name env_idx) //.$Value))) def.fuse)) (def: (with_partial arity) (-> Arity Def) (if (poly_arg? arity) (|> (enum.range n.enum 0 (n.- 2 arity)) - (list@map (.function (_ idx) - (def.field #$.Private $.finalF (reference.partial_name idx) //.$Value))) + (list@each (.function (_ idx) + (def.field #$.Private $.finalF (reference.partial_name idx) //.$Value))) def.fuse) function.identity)) @@ -284,7 +284,7 @@ (if (poly_arg? arity) (|> (n.min arity //runtime.num_apply_variants) (enum.range n.enum 1) - (list@map (with_apply classD env arity @begin bodyI)) + (list@each (with_apply classD env arity @begin bodyI)) (list& (with_implementation arity @begin bodyI)) def.fuse) (def.method #$.Public $.strictM //runtime.apply_method (//runtime.apply_signature 1) @@ -343,13 +343,13 @@ (Generator Apply) (do {@ phase.monad} [functionI (generate archive functionS) - argsI (monad.map @ (generate archive) argsS) + argsI (monad.each @ (generate archive) argsS) .let [applyI (|> argsI (list.sub //runtime.num_apply_variants) - (list@map (.function (_ subI+) - (|>> (_.CHECKCAST //.$Function) - (_.fuse subI+) - (_.INVOKEVIRTUAL //.$Function //runtime.apply_method (//runtime.apply_signature (list.size subI+)))))) + (list@each (.function (_ subI+) + (|>> (_.CHECKCAST //.$Function) + (_.fuse subI+) + (_.INVOKEVIRTUAL //.$Function //runtime.apply_method (//runtime.apply_signature (list.size subI+)))))) _.fuse)]] (in (|>> functionI applyI)))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux index 85187815d..ae1300cf9 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux @@ -42,8 +42,8 @@ [[@begin start] generation.anchor .let [pairs (|> argsS list.enumeration - (list@map (function (_ [register argument]) - [(n.+ start register) argument])))] + (list@each (function (_ [register argument]) + [(n.+ start register) argument])))] ... It may look weird that first I compile the values separately, ... and then I compile the stores/allocations. ... It must be done that way in order to avoid a potential bug. @@ -52,18 +52,18 @@ ... and stores separately, then by the time Y is evaluated, it ... will refer to the new value of X, instead of the old value, and ... shouldn't be the case. - valuesI+ (monad.map @ (function (_ [register argS]) - (: (Operation Inst) - (if (invariant? register argS) - (in function.identity) - (translate archive argS)))) - pairs) - .let [storesI+ (list@map (function (_ [register argS]) - (: Inst - (if (invariant? register argS) - function.identity - (_.ASTORE register)))) - (list.reversed pairs))]] + valuesI+ (monad.each @ (function (_ [register argS]) + (: (Operation Inst) + (if (invariant? register argS) + (in function.identity) + (translate archive argS)))) + pairs) + .let [storesI+ (list@each (function (_ [register argS]) + (: Inst + (if (invariant? register argS) + function.identity + (_.ASTORE register)))) + (list.reversed pairs))]] (in (|>> (_.fuse valuesI+) (_.fuse storesI+) (_.GOTO @begin))))) @@ -72,13 +72,13 @@ (Generator [Nat (List Synthesis) Synthesis]) (do {@ phase.monad} [@begin _.make_label - initsI+ (monad.map @ (translate archive) initsS+) + initsI+ (monad.each @ (translate archive) initsS+) iterationI (generation.with_anchor [@begin start] (translate archive iterationS)) .let [initializationI (|> (list.enumeration initsI+) - (list@map (function (_ [register initI]) - (|>> initI - (_.ASTORE (n.+ start register))))) + (list@each (function (_ [register initI]) + (|>> initI + (_.ASTORE (n.+ start register))))) _.fuse)]] (in (|>> initializationI (_.label @begin) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux index a62dc5eea..2c37cf101 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux @@ -39,7 +39,7 @@ (def: (foreign archive variable) (-> Archive Register (Operation Inst)) (do {@ phase.monad} - [class_name (\ @ map //.class_name + [class_name (\ @ each //.class_name (generation.context archive))] (in (|>> (_.ALOAD 0) (_.GETFIELD (type.class class_name (list)) @@ -62,6 +62,6 @@ (def: .public (constant archive name) (-> Archive Name (Operation Inst)) (do {@ phase.monad} - [class_name (\ @ map //.class_name + [class_name (\ @ each //.class_name (generation.remember archive name))] (in (_.GETSTATIC (type.class class_name (list)) //.value_field //.$Value)))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux index 23d59b8f4..0e758f149 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux @@ -359,17 +359,17 @@ (def: translate_function (Operation [artifact.ID (Maybe Text) Binary]) (let [applyI (|> (enum.range n.enum 2 num_apply_variants) - (list@map (function (_ arity) - ($d.method #$.Public $.noneM apply_method (apply_signature arity) - (let [preI (|> (enum.range n.enum 0 (-- arity)) - (list@map _.ALOAD) - _.fuse)] - (|>> preI - (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature (-- arity))) - (_.CHECKCAST //.$Function) - (_.ALOAD arity) - (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature 1)) - _.ARETURN))))) + (list@each (function (_ arity) + ($d.method #$.Public $.noneM apply_method (apply_signature arity) + (let [preI (|> (enum.range n.enum 0 (-- arity)) + (list@each _.ALOAD) + _.fuse)] + (|>> preI + (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature (-- arity))) + (_.CHECKCAST //.$Function) + (_.ALOAD arity) + (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature 1)) + _.ARETURN))))) (list& ($d.abstract_method #$.Public $.noneM apply_method (apply_signature 1))) $d.fuse) $Object (type.class "java.lang.Object" (list)) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux index 71e9c514f..5676fa5f9 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux @@ -50,14 +50,14 @@ (n.>= 2 size)) membersI (|> members list.enumeration - (monad.map @ (function (_ [idx member]) - (do @ - [memberI (generate archive member)] - (in (|>> _.DUP - (_.int (.int idx)) - memberI - _.AASTORE))))) - (\ @ map _.fuse))] + (monad.each @ (function (_ [idx member]) + (do @ + [memberI (generate archive member)] + (in (|>> _.DUP + (_.int (.int idx)) + memberI + _.AASTORE))))) + (\ @ each _.fuse))] (in (|>> (_.int (.int size)) (_.array //runtime.$Value) membersI)))) -- cgit v1.2.3