aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm/primitive.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-04-16 20:53:41 -0400
committerEduardo Julian2019-04-16 20:53:41 -0400
commit697707d8560a5735be38fd9b1ff91a02c289d48f (patch)
tree7f9e81974c9ec3ede82e7f2392ebba037e3e9df8 /new-luxc/source/luxc/lang/translation/jvm/primitive.lux
parent42248854f0cb5e3364e6aae25527cee65cbda3e8 (diff)
Made some new-luxc modules "old".
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm/primitive.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/primitive.lux33
1 files changed, 33 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/primitive.lux b/new-luxc/source/luxc/lang/translation/jvm/primitive.lux
new file mode 100644
index 000000000..f9d9034ea
--- /dev/null
+++ b/new-luxc/source/luxc/lang/translation/jvm/primitive.lux
@@ -0,0 +1,33 @@
+(.module:
+ [lux (#- i64)
+ [abstract
+ monad]
+ [data
+ [text
+ format]]
+ [tool
+ [compiler
+ [phase ("operation/." monad)]]]]
+ [luxc
+ [lang
+ [host
+ ["." jvm (#+ Inst Operation)
+ ["_" inst]
+ ["$t" type]]]]])
+
+(def: #export (bit value)
+ (-> Bit (Operation Inst))
+ (operation/wrap (_.GETSTATIC "java.lang.Boolean"
+ (if value "TRUE" "FALSE")
+ ($t.class "java.lang.Boolean" (list)))))
+
+(template [<name> <type> <load> <wrap>]
+ [(def: #export (<name> value)
+ (-> <type> (Operation Inst))
+ (let [loadI (|> value <load>)]
+ (operation/wrap (|>> loadI <wrap>))))]
+
+ [i64 (I64 Any) (<| _.long .int) (_.wrap #jvm.Long)]
+ [f64 Frac _.double (_.wrap #jvm.Double)]
+ [text Text _.string (<|)]
+ )