From 0cb55507c100f6817225e644c2d19e73940edad6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 6 Nov 2017 22:03:42 -0400 Subject: - Fixed some bugs. --- .../luxc/lang/translation/procedure/common.jvm.lux | 51 ++++++++++++---------- 1 file changed, 29 insertions(+), 22 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux') diff --git a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux index 8c7668383..7c049a99f 100644 --- a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux @@ -17,7 +17,8 @@ ["$i" inst])) (lang ["la" analysis] ["ls" synthesis] - (translation [";T" runtime])))) + (translation [";T" runtime] + [";T" case])))) (host;import java.lang.Long (#static MIN_VALUE Long) @@ -133,14 +134,17 @@ rightI (predicateI $i;IF_ACMPEQ))) -(def: try-method - $;Method - ($t;method (list $Function) (#;Some $Object-Array) (list))) +(def: (lux//if [testI thenI elseI]) + Trinary + (caseT;translate-if testI thenI elseI)) + (def: (lux//try riskyI) Unary (|>. riskyI ($i;CHECKCAST hostL;function-class) - ($i;INVOKESTATIC hostL;runtime-class "try" try-method false))) + ($i;INVOKESTATIC hostL;runtime-class "try" + ($t;method (list $Function) (#;Some $Object-Array) (list)) + false))) (def: (lux//noop valueI) Unary @@ -536,9 +540,11 @@ (def: lux-procs Bundle (|> (dict;new text;Hash) - (install "lux noop" (unary lux//noop)) - (install "lux is" (binary lux//is)) - (install "lux try" (unary lux//try)))) + (install "noop" (unary lux//noop)) + (install "is" (binary lux//is)) + (install "try" (unary lux//try)) + (install "if" (trinary lux//if)) + )) (def: bit-procs Bundle @@ -691,17 +697,18 @@ (def: #export procedures Bundle - (|> (dict;new text;Hash) - (dict;merge lux-procs) - (dict;merge bit-procs) - (dict;merge nat-procs) - (dict;merge int-procs) - (dict;merge deg-procs) - (dict;merge frac-procs) - (dict;merge text-procs) - (dict;merge array-procs) - (dict;merge math-procs) - (dict;merge io-procs) - (dict;merge atom-procs) - (dict;merge process-procs) - )) + (<| (prefix "lux") + (|> (dict;new text;Hash) + (dict;merge lux-procs) + (dict;merge bit-procs) + (dict;merge nat-procs) + (dict;merge int-procs) + (dict;merge deg-procs) + (dict;merge frac-procs) + (dict;merge text-procs) + (dict;merge array-procs) + (dict;merge math-procs) + (dict;merge io-procs) + (dict;merge atom-procs) + (dict;merge process-procs) + ))) -- cgit v1.2.3