aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/host/jvm/inst.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/host/jvm/inst.lux')
-rw-r--r--new-luxc/source/luxc/lang/host/jvm/inst.lux74
1 files changed, 38 insertions, 36 deletions
diff --git a/new-luxc/source/luxc/lang/host/jvm/inst.lux b/new-luxc/source/luxc/lang/host/jvm/inst.lux
index 7329dec1a..33aa290df 100644
--- a/new-luxc/source/luxc/lang/host/jvm/inst.lux
+++ b/new-luxc/source/luxc/lang/host/jvm/inst.lux
@@ -1,5 +1,6 @@
(.module:
- [lux (#- int char)
+ [lux (#- Type int char)
+ ["." host (#+ import: do-to)]
[abstract
[monad (#+ do)]]
[control
@@ -13,15 +14,16 @@
format]
[collection
["." list ("#@." functor)]]]
- ["." host (#+ import: do-to)]
[macro
["." code]
[syntax (#+ syntax:)]]
+ [target
+ [jvm
+ ["." type (#+ Primitive Method Type)]]]
[tool
[compiler
[phase (#+ Operation)]]]]
- ["." // (#+ Primitive Inst)
- ["." type]])
+ ["." // (#+ Inst)])
## [Host]
(import: #long java/lang/Object)
@@ -229,7 +231,7 @@
(template [<name> <inst>]
[(def: #export (<name> class field type)
- (-> Text Text //.Type Inst)
+ (-> Text Text Type Inst)
(function (_ visitor)
(do-to visitor
(MethodVisitor::visitFieldInsn (<inst>) (type.binary-name class) field (type.descriptor type)))))]
@@ -260,18 +262,18 @@
(do-to visitor
(MethodVisitor::visitIntInsn (Opcodes::NEWARRAY)
(case type
- #//.Boolean (Opcodes::T_BOOLEAN)
- #//.Byte (Opcodes::T_BYTE)
- #//.Short (Opcodes::T_SHORT)
- #//.Int (Opcodes::T_INT)
- #//.Long (Opcodes::T_LONG)
- #//.Float (Opcodes::T_FLOAT)
- #//.Double (Opcodes::T_DOUBLE)
- #//.Char (Opcodes::T_CHAR))))))
+ #type.Boolean (Opcodes::T_BOOLEAN)
+ #type.Byte (Opcodes::T_BYTE)
+ #type.Short (Opcodes::T_SHORT)
+ #type.Int (Opcodes::T_INT)
+ #type.Long (Opcodes::T_LONG)
+ #type.Float (Opcodes::T_FLOAT)
+ #type.Double (Opcodes::T_DOUBLE)
+ #type.Char (Opcodes::T_CHAR))))))
(template [<name> <inst>]
[(def: #export (<name> class method-name method-signature interface?)
- (-> Text Text //.Method Bit Inst)
+ (-> Text Text Method Bit Inst)
(function (_ visitor)
(do-to visitor
(MethodVisitor::visitMethodInsn (<inst>) (type.binary-name class) method-name (type.method-descriptor method-signature) interface?))))]
@@ -324,14 +326,14 @@
(MethodVisitor::visitLabel @label))))
(def: #export (array type)
- (-> //.Type Inst)
+ (-> Type Inst)
(case type
- (#//.Primitive prim)
+ (#type.Primitive prim)
(NEWARRAY prim)
- (#//.Generic generic)
+ (#type.Generic generic)
(let [elem-class (case generic
- (#//.Class class params)
+ (#type.Class class params)
(type.binary-name class)
_
@@ -344,32 +346,32 @@
(def: (primitive-wrapper type)
(-> Primitive Text)
(case type
- #//.Boolean "java.lang.Boolean"
- #//.Byte "java.lang.Byte"
- #//.Short "java.lang.Short"
- #//.Int "java.lang.Integer"
- #//.Long "java.lang.Long"
- #//.Float "java.lang.Float"
- #//.Double "java.lang.Double"
- #//.Char "java.lang.Character"))
+ #type.Boolean "java.lang.Boolean"
+ #type.Byte "java.lang.Byte"
+ #type.Short "java.lang.Short"
+ #type.Int "java.lang.Integer"
+ #type.Long "java.lang.Long"
+ #type.Float "java.lang.Float"
+ #type.Double "java.lang.Double"
+ #type.Char "java.lang.Character"))
(def: (primitive-unwrap type)
(-> Primitive Text)
(case type
- #//.Boolean "booleanValue"
- #//.Byte "byteValue"
- #//.Short "shortValue"
- #//.Int "intValue"
- #//.Long "longValue"
- #//.Float "floatValue"
- #//.Double "doubleValue"
- #//.Char "charValue"))
+ #type.Boolean "booleanValue"
+ #type.Byte "byteValue"
+ #type.Short "shortValue"
+ #type.Int "intValue"
+ #type.Long "longValue"
+ #type.Float "floatValue"
+ #type.Double "doubleValue"
+ #type.Char "charValue"))
(def: #export (wrap type)
(-> Primitive Inst)
(let [class (primitive-wrapper type)]
(|>> (INVOKESTATIC class "valueOf"
- (type.method (list (#//.Primitive type))
+ (type.method (list (#type.Primitive type))
(#.Some (type.class class (list)))
(list))
#0))))
@@ -379,7 +381,7 @@
(let [class (primitive-wrapper type)]
(|>> (CHECKCAST class)
(INVOKEVIRTUAL class (primitive-unwrap type)
- (type.method (list) (#.Some (#//.Primitive type)) (list))
+ (type.method (list) (#.Some (#type.Primitive type)) (list))
#0))))
(def: #export (fuse insts)