diff options
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/procedure')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux | 51 |
1 files changed, 29 insertions, 22 deletions
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<Text>) - (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<Text>) - (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<Text>) + (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) + ))) |