aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/generator/procedure/common.jvm.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-10-12 01:27:48 -0400
committerEduardo Julian2017-10-12 01:27:48 -0400
commitf3acc0d67e6cd4e7245c1e169a3c0469da4373a3 (patch)
tree9ed4796b085abb535ae6bee2f804166c30787691 /new-luxc/source/luxc/generator/procedure/common.jvm.lux
parent1594c2c866db18c6c5360ae2451ffd38b879fc49 (diff)
- Compilation and tests for primitive conversions.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/generator/procedure/common.jvm.lux29
1 files changed, 18 insertions, 11 deletions
diff --git a/new-luxc/source/luxc/generator/procedure/common.jvm.lux b/new-luxc/source/luxc/generator/procedure/common.jvm.lux
index ffbe69708..70f38f962 100644
--- a/new-luxc/source/luxc/generator/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/generator/procedure/common.jvm.lux
@@ -34,22 +34,22 @@
(#static NEGATIVE_INFINITY Double))
## [Types]
-(type: Generator
+(type: #export Generator
(-> ls;Synthesis (Lux $;Inst)))
-(type: Proc
+(type: #export Proc
(-> Generator (List ls;Synthesis) (Lux $;Inst)))
-(type: Bundle
+(type: #export Bundle
(Dict Text Proc))
(syntax: (Vector [size s;nat] elemT)
(wrap (list (` [(~@ (list;repeat size elemT))]))))
-(type: Nullary (-> (Vector +0 $;Inst) $;Inst))
-(type: Unary (-> (Vector +1 $;Inst) $;Inst))
-(type: Binary (-> (Vector +2 $;Inst) $;Inst))
-(type: Trinary (-> (Vector +3 $;Inst) $;Inst))
+(type: #export Nullary (-> (Vector +0 $;Inst) $;Inst))
+(type: #export Unary (-> (Vector +1 $;Inst) $;Inst))
+(type: #export Binary (-> (Vector +2 $;Inst) $;Inst))
+(type: #export Trinary (-> (Vector +3 $;Inst) $;Inst))
## [Utils]
(def: $Object $;Type ($t;class "java.lang.Object" (list)))
@@ -58,12 +58,19 @@
(def: $CharSequence $;Type ($t;class "java.lang.CharSequence" (list)))
(def: $Function $;Type ($t;class &runtime;function-class (list)))
-(def: (install name unnamed)
+(def: #export (install name unnamed)
(-> Text (-> Text Proc)
(-> Bundle Bundle))
(dict;put name (unnamed name)))
-(def: (wrong-amount-error proc expected actual)
+(def: #export (prefix prefix bundle)
+ (-> Text Bundle Bundle)
+ (|> bundle
+ dict;entries
+ (list/map (function [[key val]] [(format prefix " " key) val]))
+ (dict;from-list text;Hash<Text>)))
+
+(def: (wrong-arity proc expected actual)
(-> Text Nat Nat Text)
(format "Wrong number of arguments for " (%t proc) "\n"
"Expected: " (|> expected nat-to-int %i) "\n"
@@ -73,7 +80,7 @@
(with-gensyms [g!proc g!name g!generate g!inputs]
(do @
[g!input+ (monad;seq @ (list;repeat arity (macro;gensym "input")))]
- (wrap (list (` (def: ((~ (code;local-symbol name)) (~ g!proc))
+ (wrap (list (` (def: #export ((~ (code;local-symbol name)) (~ g!proc))
(-> (-> (Vector (~ (code;nat arity)) $;Inst) $;Inst)
(-> Text Proc))
(function [(~ g!name)]
@@ -88,7 +95,7 @@
((~' wrap) ((~ g!proc) [(~@ g!input+)])))
(~' _)
- (macro;fail (wrong-amount-error (~ g!name) +1 (list;size (~ g!inputs))))))))))))))
+ (macro;fail (wrong-arity (~ g!name) +1 (list;size (~ g!inputs))))))))))))))
(arity: nullary +0)
(arity: unary +1)