diff options
author | Eduardo Julian | 2020-11-24 05:18:04 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-11-24 05:18:04 -0400 |
commit | c4bbfea18d995948012f45a6afda7a6e6ba56f84 (patch) | |
tree | b3c425471830788965776fd173169f084d9f6af4 /lux-jvm | |
parent | d89d837de3475b75587a4293e094d755d2cd4626 (diff) |
Better error messages when re-using a name when making a definition.
Diffstat (limited to '')
-rw-r--r-- | lux-jvm/source/luxc/lang/directive/jvm.lux | 28 | ||||
-rw-r--r-- | lux-jvm/source/luxc/lang/translation/jvm/case.lux | 102 | ||||
-rw-r--r-- | lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux | 22 | ||||
-rw-r--r-- | lux-jvm/source/luxc/lang/translation/jvm/primitive.lux | 20 |
4 files changed, 86 insertions, 86 deletions
diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index 798cf8298..0ec4fb1d5 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -223,8 +223,8 @@ (-> /.Object Inst) (case instruction (^template [<tag> <inst>] - (<tag> class field-name field-type) - (<inst> class field-name field-type)) + [(<tag> class field-name field-type) + (<inst> class field-name field-type)]) ([#/.GETSTATIC _.GETSTATIC] [#/.PUTSTATIC _.PUTSTATIC] [#/.GETFIELD _.GETFIELD] @@ -236,8 +236,8 @@ (#/.CHECKCAST type) (_.CHECKCAST type) (^template [<tag> <inst>] - (<tag> class method-name method-type) - (<inst> class method-name method-type)) + [(<tag> class method-name method-type) + (<inst> class method-name method-type)]) ([#/.INVOKEINTERFACE _.INVOKEINTERFACE] [#/.INVOKESPECIAL _.INVOKESPECIAL] [#/.INVOKESTATIC _.INVOKESTATIC] @@ -402,9 +402,9 @@ (Re-labeler /.Branching) (case instruction (^template [<tag>] - (<tag> label) - (let [[mapping label] (..relabel [mapping label])] - [mapping (<tag> label)])) + [(<tag> label) + (let [[mapping label] (..relabel [mapping label])] + [mapping (<tag> label)])]) ([#/.IF_ICMPEQ] [#/.IF_ICMPGE] [#/.IF_ICMPGT] [#/.IF_ICMPLE] [#/.IF_ICMPLT] [#/.IF_ICMPNE] [#/.IFEQ] [#/.IFNE] [#/.IFGE] [#/.IFGT] [#/.IFLE] [#/.IFLT] @@ -444,16 +444,16 @@ (Re-labeler /.Control) (case instruction (^template [<tag> <relabel>] - (<tag> instruction) - (let [[mapping instruction] (<relabel> [mapping instruction])] - [mapping (<tag> instruction)])) + [(<tag> instruction) + (let [[mapping instruction] (<relabel> [mapping instruction])] + [mapping (<tag> instruction)])]) ([#/.GOTO ..relabel] [#/.Branching ..relabel-branching] [#/.Exception ..relabel-exception]) (^template [<tag>] - (<tag> instruction) - [mapping (<tag> instruction)]) + [(<tag> instruction) + [mapping (<tag> instruction)]]) ([#/.Concurrency] [#/.Return]) )) @@ -463,8 +463,8 @@ #/.NOP [mapping #/.NOP] (^template [<tag>] - (<tag> instruction) - [mapping (<tag> instruction)]) + [(<tag> instruction) + [mapping (<tag> instruction)]]) ([#/.Constant] [#/.Arithmetic] [#/.Bitwise] 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 [<tag> <unwrap> <dup> <pop> <test> <comparison> <if>] - (<tag> 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)) - (|>> <dup> - (<test> test) - <comparison> - (<if> @else) - <pop> - thenG - (_.label @else) - elseG))))) - (|>> <pop> - (_.GOTO @else)) - (#.Cons cons)))] - (wrap (|>> peekI - <unwrap> - forkG)))) + [(<tag> 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)) + (|>> <dup> + (<test> test) + <comparison> + (<if> @else) + <pop> + thenG + (_.label @else) + elseG))))) + (|>> <pop> + (_.GOTO @else)) + (#.Cons cons)))] + (wrap (|>> peekI + <unwrap> + 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 [<pattern> <right?>] - (^ (<pattern> lefts)) - (operation@wrap (<| _.with-label (function (_ @success)) - _.with-label (function (_ @fail)) - (|>> peekI - (_.CHECKCAST //.$Variant) - (structure.tagI lefts <right?>) - (structure.flagI <right?>) - (_.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)))) + [(^ (<pattern> lefts)) + (operation@wrap (<| _.with-label (function (_ @success)) + _.with-label (function (_ @fail)) + (|>> peekI + (_.CHECKCAST //.$Variant) + (structure.tagI lefts <right?>) + (structure.flagI <right?>) + (_.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 [<path> <projection>] - (^ (<path> lefts)) - (operation@wrap (|>> peekI - (<projection> lefts) - pushI)) - - (^ (synthesis.path/seq - (<path> lefts) - (synthesis.!bind-top register thenP))) - (do phase.monad - [then! (path' stack-depth @else @end phase archive thenP)] - (wrap (|>> peekI - (<projection> lefts) - (_.ASTORE register) - then!)))) + [(^ (<path> lefts)) + (operation@wrap (|>> peekI + (<projection> lefts) + pushI)) + + (^ (synthesis.path/seq + (<path> lefts) + (synthesis.!bind-top register thenP))) + (do phase.monad + [then! (path' stack-depth @else @end phase archive thenP)] + (wrap (|>> peekI + (<projection> lefts) + (_.ASTORE register) + then!)))]) ([synthesis.member/left ..left-projection] [synthesis.member/right ..right-projection]) 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 26db95ac1..86b814bad 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -822,14 +822,14 @@ (synthesis.path/then (normalize bodyS)) (^template [<tag>] - (^ (<tag> leftP rightP)) - (<tag> (recur leftP) (recur rightP))) + [(^ (<tag> leftP rightP)) + (<tag> (recur leftP) (recur rightP))]) ([#synthesis.Alt] [#synthesis.Seq]) (^template [<tag>] - (^ (<tag> value)) - path) + [(^ (<tag> value)) + path]) ([#synthesis.Pop] [#synthesis.Bind] [#synthesis.Access]) @@ -838,11 +838,11 @@ (#synthesis.Bit-Fork when (recur then) (maybe@map 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)])) + [(<tag> [[test then] elses]) + (<tag> [[test (recur then)] + (list@map (function (_ [else-test else-then]) + [else-test (recur else-then)]) + elses)])]) ([#synthesis.I64-Fork] [#synthesis.F64-Fork] [#synthesis.Text-Fork]) @@ -853,8 +853,8 @@ (function (recur body) (case body (^template [<tag>] - (^ (<tag> value)) - body) + [(^ (<tag> value)) + body]) ([#synthesis.Primitive] [synthesis.constant]) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux index d8ab2cbee..2e0aba43e 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux @@ -34,14 +34,14 @@ (-> (I64 Any) (Operation Inst)) (case (.int value) (^template [<int> <instruction>] - <int> - (operation@wrap (|>> <instruction> (_.wrap type.long)))) + [<int> + (operation@wrap (|>> <instruction> (_.wrap type.long)))]) ([+0 _.LCONST_0] [+1 _.LCONST_1]) (^template [<int> <instruction>] - <int> - (operation@wrap (|>> <instruction> _.I2L (_.wrap type.long)))) + [<int> + (operation@wrap (|>> <instruction> _.I2L (_.wrap type.long)))]) ([-1 _.ICONST_M1] ## [+0 _.ICONST_0] ## [+1 _.ICONST_1] @@ -74,18 +74,18 @@ (-> Frac (Operation Inst)) (case value (^template [<int> <instruction>] - <int> - (operation@wrap (|>> <instruction> (_.wrap type.double)))) + [<int> + (operation@wrap (|>> <instruction> (_.wrap type.double)))]) ([+1.0 _.DCONST_1]) (^template [<int> <instruction>] - <int> - (operation@wrap (|>> <instruction> _.F2D (_.wrap type.double)))) + [<int> + (operation@wrap (|>> <instruction> _.F2D (_.wrap type.double)))]) ([+2.0 _.FCONST_2]) (^template [<int> <instruction>] - <int> - (operation@wrap (|>> <instruction> _.I2D (_.wrap type.double)))) + [<int> + (operation@wrap (|>> <instruction> _.I2D (_.wrap type.double)))]) ([-1.0 _.ICONST_M1] ## [+0.0 _.ICONST_0] ## [+1.0 _.ICONST_1] |