aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc
diff options
context:
space:
mode:
authorEduardo Julian2019-10-16 02:19:52 -0400
committerEduardo Julian2019-10-16 02:19:52 -0400
commit3028cc4f45d2d7d66456467de506341800df14d8 (patch)
tree184a517a4b0634fd50d834b4b16753fd11c691a2 /new-luxc/source/luxc
parent688870c71829e1bee89c9f827cc2032507cc507b (diff)
Now allowing types for methods.
Diffstat (limited to 'new-luxc/source/luxc')
-rw-r--r--new-luxc/source/luxc/lang/host/jvm/def.lux20
-rw-r--r--new-luxc/source/luxc/lang/host/jvm/inst.lux9
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/extension/host.lux5
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/function.lux8
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/runtime.lux11
5 files changed, 25 insertions, 28 deletions
diff --git a/new-luxc/source/luxc/lang/host/jvm/def.lux b/new-luxc/source/luxc/lang/host/jvm/def.lux
index 08fccc640..f274da61f 100644
--- a/new-luxc/source/luxc/lang/host/jvm/def.lux
+++ b/new-luxc/source/luxc/lang/host/jvm/def.lux
@@ -18,8 +18,8 @@
["." name]]
["." type (#+ Type Constraint)
[category (#+ Class Value Method)]
- ["." signature (#+ Signature)]
- ["." descriptor (#+ Descriptor)]]]]]
+ ["." signature]
+ ["." descriptor]]]]]
["." //])
(def: signature (|>> type.signature signature.signature))
@@ -211,16 +211,16 @@
_ (ClassWriter::visitEnd writer)]
(ClassWriter::toByteArray writer)))
-(def: #export (method visibility config name [signature descriptor] then)
- (-> //.Visibility //.Method-Config Text [(Signature Method) (Descriptor Method)] //.Inst
+(def: #export (method visibility config name type then)
+ (-> //.Visibility //.Method-Config Text (Type Method) //.Inst
//.Def)
(function (_ writer)
(let [=method (ClassWriter::visitMethod ($_ i.+
(visibility-flag visibility)
(method-flags config))
(..binary-name name)
- (descriptor.descriptor descriptor)
- (signature.signature signature)
+ (..descriptor type)
+ (..signature type)
(string-array (list))
writer)
_ (MethodVisitor::visitCode =method)
@@ -229,8 +229,8 @@
_ (MethodVisitor::visitEnd =method)]
writer)))
-(def: #export (abstract-method visibility config name [signature descriptor])
- (-> //.Visibility //.Method-Config Text [(Signature Method) (Descriptor Method)]
+(def: #export (abstract-method visibility config name type)
+ (-> //.Visibility //.Method-Config Text (Type Method)
//.Def)
(function (_ writer)
(let [=method (ClassWriter::visitMethod ($_ i.+
@@ -238,8 +238,8 @@
(method-flags config)
(Opcodes::ACC_ABSTRACT))
(..binary-name name)
- (descriptor.descriptor descriptor)
- (signature.signature signature)
+ (..descriptor type)
+ (..signature type)
(string-array (list))
writer)
_ (MethodVisitor::visitEnd =method)]
diff --git a/new-luxc/source/luxc/lang/host/jvm/inst.lux b/new-luxc/source/luxc/lang/host/jvm/inst.lux
index d5d7cb1fb..e52d11d9b 100644
--- a/new-luxc/source/luxc/lang/host/jvm/inst.lux
+++ b/new-luxc/source/luxc/lang/host/jvm/inst.lux
@@ -27,8 +27,7 @@
["." type (#+ Type) ("#@." equivalence)
[category (#+ Void Value Return Method Primitive Object Class Array Var Parameter)]
["." box]
- ["." signature (#+ Signature)]
- ["." descriptor (#+ Descriptor)]
+ ["." descriptor]
["." reflection]]]]
[tool
[compiler
@@ -297,14 +296,14 @@
(undefined)))))))
(template [<name> <inst> <interface?>]
- [(def: #export (<name> class method-name [method-signature method-descriptor])
- (-> (Type Class) Text [(Signature Method) (Descriptor Method)] Inst)
+ [(def: #export (<name> class method-name method)
+ (-> (Type Class) Text (Type Method) Inst)
(function (_ visitor)
(do-to visitor
(org/objectweb/asm/MethodVisitor::visitMethodInsn (<inst>)
(..class-name class)
method-name
- (descriptor.descriptor method-descriptor)
+ (|> method type.descriptor descriptor.descriptor)
<interface?>))))]
[INVOKESTATIC org/objectweb/asm/Opcodes::INVOKESTATIC false]
diff --git a/new-luxc/source/luxc/lang/translation/jvm/extension/host.lux b/new-luxc/source/luxc/lang/translation/jvm/extension/host.lux
index ea7ba6d33..7b03bc451 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/extension/host.lux
@@ -24,8 +24,7 @@
["." category (#+ Void Value Return Primitive Object Class Array Var Parameter Method)]
["." box]
["." reflection]
- ["." descriptor (#+ Descriptor)]
- ["." signature (#+ Signature)]
+ ["." signature]
["." parser]]]]
[tool
[compiler
@@ -881,7 +880,7 @@
(def: $Object (type.class "java.lang.Object" (list)))
(def: (anonymous-init-method env)
- (-> Environment [(Signature Method) (Descriptor Method)])
+ (-> Environment (Type Method))
(type.method [(list.repeat (list.size env) $Object)
type.void
(list)]))
diff --git a/new-luxc/source/luxc/lang/translation/jvm/function.lux b/new-luxc/source/luxc/lang/translation/jvm/function.lux
index bd651f786..34a4c890e 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/function.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/function.lux
@@ -14,9 +14,7 @@
[target
[jvm
["." type (#+ Type)
- ["." category (#+ Void Value Return Primitive Object Class Array Var Parameter Method)]
- ["." descriptor (#+ Descriptor)]
- ["." signature (#+ Signature)]]]]
+ ["." category (#+ Void Value Return Primitive Object Class Array Var Parameter Method)]]]]
[tool
[compiler
[arity (#+ Arity)]
@@ -46,7 +44,7 @@
(list.repeat (list.size env) //.$Value))
(def: (init-method env arity)
- (-> Environment Arity [(Signature Method) (Descriptor Method)])
+ (-> Environment Arity (Type Method))
(if (poly-arg? arity)
(type.method [(list.concat (list (captured-args env)
(list type.int)
@@ -112,7 +110,7 @@
(_.INVOKESPECIAL class "<init>" (init-method env arity))))))
(def: (reset-method return)
- (-> (Type Class) [(Signature Method) (Descriptor Method)])
+ (-> (Type Class) (Type Method))
(type.method [(list) return (list)]))
(def: (with-reset class arity env)
diff --git a/new-luxc/source/luxc/lang/translation/jvm/runtime.lux b/new-luxc/source/luxc/lang/translation/jvm/runtime.lux
index f97831ac5..c0e48f30d 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/runtime.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/runtime.lux
@@ -9,9 +9,7 @@
[target
[jvm
["." type (#+ Type)
- ["." category (#+ Void Value Return Primitive Object Class Array Var Parameter Method)]
- ["." descriptor (#+ Descriptor)]
- ["." signature (#+ Signature)]
+ ["." category (#+ Void Value' Value Return' Return Primitive Object Class Array Var Parameter Method)]
["." reflection]]]]
[tool
[compiler
@@ -106,7 +104,7 @@
(def: #export num-apply-variants Nat 8)
(def: #export (apply-signature arity)
- (-> Arity [(Signature Method) (Descriptor Method)])
+ (-> Arity (Type Method))
(type.method [(list.repeat arity $Value) $Value (list)]))
(def: adt-methods
@@ -319,7 +317,10 @@
_.ARETURN)))
)))
-(def: reflection (|>> type.reflection reflection.reflection))
+(def: reflection
+ (All [category]
+ (-> (Type (<| Return' Value' category)) Text))
+ (|>> type.reflection reflection.reflection))
(def: translate-runtime
(Operation Any)