From d4ded2084127fd8953d2889d72bab889213000a1 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 7 Apr 2019 21:12:08 -0400 Subject: Upgraded the tuple right-access mechanism to the new style. --- .../source/luxc/lang/translation/jvm/case.jvm.lux | 52 ++++++++++++---------- 1 file changed, 29 insertions(+), 23 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux') diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux index 22817e8eb..43d11c71e 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux @@ -132,29 +132,35 @@ ([synthesis.side/left _.NULL function.identity] [synthesis.side/right (_.string "") .inc]) - (^template [ ] - (^ ( idx)) - (operation/wrap (.case ( idx) - 0 - (|>> peekI - (_.CHECKCAST ($t.descriptor runtime.$Tuple)) - (_.int +0) - _.AALOAD - pushI) - - idx - (|>> peekI - (_.CHECKCAST ($t.descriptor runtime.$Tuple)) - (_.int (.int idx)) - (_.INVOKESTATIC //.runtime-class - - ($t.method (list runtime.$Tuple $t.int) - (#.Some $Object) - (list)) - #0) - pushI)))) - ([synthesis.member/left "tuple_left" <|] - [synthesis.member/right "pm_right" inc]) + (^ (synthesis.member/left lefts)) + (operation/wrap (.let [accessI (.case lefts + 0 + _.AALOAD + + lefts + (_.INVOKESTATIC //.runtime-class + "tuple_left" + ($t.method (list runtime.$Tuple $t.int) + (#.Some $Object) + (list)) + #0))] + (|>> peekI + (_.CHECKCAST ($t.descriptor runtime.$Tuple)) + (_.int (.int lefts)) + accessI + pushI))) + + (^ (synthesis.member/right lefts)) + (operation/wrap (|>> peekI + (_.CHECKCAST ($t.descriptor runtime.$Tuple)) + (_.int (.int lefts)) + (_.INVOKESTATIC //.runtime-class + "tuple_right" + ($t.method (list runtime.$Tuple $t.int) + (#.Some $Object) + (list)) + #0) + pushI)) (#synthesis.Alt leftP rightP) (do phase.monad -- cgit v1.2.3