From c4bbfea18d995948012f45a6afda7a6e6ba56f84 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 24 Nov 2020 05:18:04 -0400 Subject: Better error messages when re-using a name when making a definition. --- lux-jvm/source/luxc/lang/translation/jvm/case.lux | 102 +++++++++++----------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'lux-jvm/source/luxc/lang/translation/jvm/case.lux') diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux index eea77aaf0..68d9b4347 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux @@ -118,27 +118,27 @@ elseG)))) (^template [ ] - ( cons) - (do {@ phase.monad} - [forkG (: (Operation Inst) - (monad.fold @ (function (_ [test thenP] elseG) - (do @ - [thenG (path' stack-depth @else @end phase archive thenP)] - (wrap (<| _.with-label (function (_ @else)) - (|>> - ( test) - - ( @else) - - thenG - (_.label @else) - elseG))))) - (|>> - (_.GOTO @else)) - (#.Cons cons)))] - (wrap (|>> peekI - - forkG)))) + [( cons) + (do {@ phase.monad} + [forkG (: (Operation Inst) + (monad.fold @ (function (_ [test thenP] elseG) + (do @ + [thenG (path' stack-depth @else @end phase archive thenP)] + (wrap (<| _.with-label (function (_ @else)) + (|>> + ( test) + + ( @else) + + thenG + (_.label @else) + elseG))))) + (|>> + (_.GOTO @else)) + (#.Cons cons)))] + (wrap (|>> peekI + + forkG)))]) ([#synthesis.I64-Fork (_.unwrap type.long) _.DUP2 _.POP2 (|>> .int _.long) _.LCMP _.IFNE] [#synthesis.F64-Fork (_.unwrap type.double) _.DUP2 _.POP2 _.double _.DCMPL _.IFNE] [#synthesis.Text-Fork (|>) _.DUP _.POP _.string @@ -153,41 +153,41 @@ (_.GOTO @end)))) (^template [ ] - (^ ( lefts)) - (operation@wrap (<| _.with-label (function (_ @success)) - _.with-label (function (_ @fail)) - (|>> peekI - (_.CHECKCAST //.$Variant) - (structure.tagI lefts ) - (structure.flagI ) - (_.INVOKESTATIC //.$Runtime "pm_variant" (type.method [(list //.$Variant runtime.$Tag runtime.$Flag) runtime.$Value (list)])) - _.DUP - (_.IFNULL @fail) - (_.GOTO @success) - (_.label @fail) - _.POP - (_.GOTO @else) - (_.label @success) - pushI)))) + [(^ ( lefts)) + (operation@wrap (<| _.with-label (function (_ @success)) + _.with-label (function (_ @fail)) + (|>> peekI + (_.CHECKCAST //.$Variant) + (structure.tagI lefts ) + (structure.flagI ) + (_.INVOKESTATIC //.$Runtime "pm_variant" (type.method [(list //.$Variant runtime.$Tag runtime.$Flag) runtime.$Value (list)])) + _.DUP + (_.IFNULL @fail) + (_.GOTO @success) + (_.label @fail) + _.POP + (_.GOTO @else) + (_.label @success) + pushI)))]) ([synthesis.side/left false] [synthesis.side/right true]) ## Extra optimization (^template [ ] - (^ ( lefts)) - (operation@wrap (|>> peekI - ( lefts) - pushI)) - - (^ (synthesis.path/seq - ( lefts) - (synthesis.!bind-top register thenP))) - (do phase.monad - [then! (path' stack-depth @else @end phase archive thenP)] - (wrap (|>> peekI - ( lefts) - (_.ASTORE register) - then!)))) + [(^ ( lefts)) + (operation@wrap (|>> peekI + ( lefts) + pushI)) + + (^ (synthesis.path/seq + ( lefts) + (synthesis.!bind-top register thenP))) + (do phase.monad + [then! (path' stack-depth @else @end phase archive thenP)] + (wrap (|>> peekI + ( lefts) + (_.ASTORE register) + then!)))]) ([synthesis.member/left ..left-projection] [synthesis.member/right ..right-projection]) -- cgit v1.2.3