From b14102eaa2a80f51f160ba293ec01928dbe683c3 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 22 Jul 2018 02:52:46 -0400 Subject: - Some fixes due to recent changes in stdlib. - Removed some (now) useless modules. --- .../luxc/lang/translation/jvm/structure.jvm.lux | 57 +++++++++++----------- 1 file changed, 29 insertions(+), 28 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux') diff --git a/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux index bc4a3cb95..4c29260f5 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux @@ -1,23 +1,24 @@ (.module: [lux #* [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)]] [data [text format] [collection ["." list]]] - [language - ["." compiler - [synthesis (#+ Synthesis)]]]] + [compiler + [default + ["." phase + [synthesis (#+ Synthesis)]]]]] [luxc [lang [host - ["." jvm (#+ Inst Operation Compiler) + ["." jvm (#+ Inst Operation Phase) ["$t" type] - ["$i" inst]]]]] - [//]) + ["_" inst]]]]] + ["." //]) (exception: #export (not-a-tuple {size Nat}) (ex.report ["Expected size" ">= 2"] @@ -26,41 +27,41 @@ (def: $Object jvm.Type ($t.class "java.lang.Object" (list))) (def: #export (tuple translate members) - (-> Compiler (List Synthesis) (Operation Inst)) - (do compiler.Monad + (-> Phase (List Synthesis) (Operation Inst)) + (do phase.Monad [#let [size (list.size members)] - _ (compiler.assert not-a-tuple size - (n/>= +2 size)) + _ (phase.assert not-a-tuple size + (n/>= +2 size)) membersI (|> members list.enumerate (monad.map @ (function (_ [idx member]) (do @ [memberI (translate member)] - (wrap (|>> $i.DUP - ($i.int (.int idx)) + (wrap (|>> _.DUP + (_.int (.int idx)) memberI - $i.AASTORE))))) - (:: @ map $i.fuse))] - (wrap (|>> ($i.int (.int size)) - ($i.array $Object) + _.AASTORE))))) + (:: @ map _.fuse))] + (wrap (|>> (_.int (.int size)) + (_.array $Object) membersI)))) (def: (flagI tail?) (-> Bit Inst) (if tail? - ($i.string "") - $i.NULL)) + (_.string "") + _.NULL)) (def: #export (variant translate tag tail? member) - (-> Compiler Nat Bit Synthesis (Operation Inst)) - (do compiler.Monad + (-> Phase Nat Bit Synthesis (Operation Inst)) + (do phase.Monad [memberI (translate member)] - (wrap (|>> ($i.int (.int tag)) + (wrap (|>> (_.int (.int tag)) (flagI tail?) memberI - ($i.INVOKESTATIC //.runtime-class - "variant_make" - ($t.method (list $t.int $Object $Object) - (#.Some ($t.array +1 $Object)) - (list)) - #0))))) + (_.INVOKESTATIC //.runtime-class + "variant_make" + ($t.method (list $t.int $Object $Object) + (#.Some ($t.array +1 $Object)) + (list)) + #0))))) -- cgit v1.2.3