aboutsummaryrefslogtreecommitdiff
path: root/new-luxc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/host/jvm/def.lux72
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux21
2 files changed, 56 insertions, 37 deletions
diff --git a/new-luxc/source/luxc/lang/host/jvm/def.lux b/new-luxc/source/luxc/lang/host/jvm/def.lux
index 06e6963a3..ce236c905 100644
--- a/new-luxc/source/luxc/lang/host/jvm/def.lux
+++ b/new-luxc/source/luxc/lang/host/jvm/def.lux
@@ -13,7 +13,7 @@
[target
[jvm
["$t" type (#+ Method Class Type Parameter)]]]]
- ["$" //])
+ ["." //])
(import: #long java/lang/Object)
(import: #long java/lang/String)
@@ -78,45 +78,45 @@
string-array))
(def: (version-flag version)
- (-> $.Version Int)
+ (-> //.Version Int)
(case version
- #$.V1_1 (Opcodes::V1_1)
- #$.V1_2 (Opcodes::V1_2)
- #$.V1_3 (Opcodes::V1_3)
- #$.V1_4 (Opcodes::V1_4)
- #$.V1_5 (Opcodes::V1_5)
- #$.V1_6 (Opcodes::V1_6)
- #$.V1_7 (Opcodes::V1_7)
- #$.V1_8 (Opcodes::V1_8)))
+ #//.V1_1 (Opcodes::V1_1)
+ #//.V1_2 (Opcodes::V1_2)
+ #//.V1_3 (Opcodes::V1_3)
+ #//.V1_4 (Opcodes::V1_4)
+ #//.V1_5 (Opcodes::V1_5)
+ #//.V1_6 (Opcodes::V1_6)
+ #//.V1_7 (Opcodes::V1_7)
+ #//.V1_8 (Opcodes::V1_8)))
(def: (visibility-flag visibility)
- (-> $.Visibility Int)
+ (-> //.Visibility Int)
(case visibility
- #$.Public (Opcodes::ACC_PUBLIC)
- #$.Protected (Opcodes::ACC_PROTECTED)
- #$.Private (Opcodes::ACC_PRIVATE)
- #$.Default +0))
+ #//.Public (Opcodes::ACC_PUBLIC)
+ #//.Protected (Opcodes::ACC_PROTECTED)
+ #//.Private (Opcodes::ACC_PRIVATE)
+ #//.Default +0))
(def: (class-flags config)
- (-> $.Class-Config Int)
+ (-> //.Class-Config Int)
($_ i/+
- (if (get@ #$.finalC config) (Opcodes::ACC_FINAL) +0)))
+ (if (get@ #//.finalC config) (Opcodes::ACC_FINAL) +0)))
(def: (method-flags config)
- (-> $.Method-Config Int)
+ (-> //.Method-Config Int)
($_ i/+
- (if (get@ #$.staticM config) (Opcodes::ACC_STATIC) +0)
- (if (get@ #$.finalM config) (Opcodes::ACC_FINAL) +0)
- (if (get@ #$.synchronizedM config) (Opcodes::ACC_SYNCHRONIZED) +0)
- (if (get@ #$.strictM config) (Opcodes::ACC_STRICT) +0)))
+ (if (get@ #//.staticM config) (Opcodes::ACC_STATIC) +0)
+ (if (get@ #//.finalM config) (Opcodes::ACC_FINAL) +0)
+ (if (get@ #//.synchronizedM config) (Opcodes::ACC_SYNCHRONIZED) +0)
+ (if (get@ #//.strictM config) (Opcodes::ACC_STRICT) +0)))
(def: (field-flags config)
- (-> $.Field-Config Int)
+ (-> //.Field-Config Int)
($_ i/+
- (if (get@ #$.staticF config) (Opcodes::ACC_STATIC) +0)
- (if (get@ #$.finalF config) (Opcodes::ACC_FINAL) +0)
- (if (get@ #$.transientF config) (Opcodes::ACC_TRANSIENT) +0)
- (if (get@ #$.volatileF config) (Opcodes::ACC_VOLATILE) +0)))
+ (if (get@ #//.staticF config) (Opcodes::ACC_STATIC) +0)
+ (if (get@ #//.finalF config) (Opcodes::ACC_FINAL) +0)
+ (if (get@ #//.transientF config) (Opcodes::ACC_TRANSIENT) +0)
+ (if (get@ #//.volatileF config) (Opcodes::ACC_VOLATILE) +0)))
(def: class-to-type
(-> Class Type)
@@ -160,7 +160,7 @@
(template [<name> <flag>]
[(def: #export (<name> version visibility config name parameters super interfaces
definitions)
- (-> $.Version $.Visibility $.Class-Config Text (List Parameter) Class (List Class) $.Def
+ (-> //.Version //.Visibility //.Class-Config Text (List Parameter) Class (List Class) //.Def
(host.type (Array byte)))
(let [writer (|> (do-to (ClassWriter::new class-computes)
(ClassWriter::visit (version-flag version)
@@ -187,7 +187,7 @@
(def: #export (interface version visibility config name parameters interfaces
definitions)
- (-> $.Version $.Visibility $.Class-Config Text (List Parameter) (List Class) $.Def
+ (-> //.Version //.Visibility //.Class-Config Text (List Parameter) (List Class) //.Def
(host.type (Array byte)))
(let [writer (|> (do-to (ClassWriter::new class-computes)
(ClassWriter::visit (version-flag version)
@@ -207,8 +207,8 @@
(ClassWriter::toByteArray writer)))
(def: #export (method visibility config name type then)
- (-> $.Visibility $.Method-Config Text Method $.Inst
- $.Def)
+ (-> //.Visibility //.Method-Config Text Method //.Inst
+ //.Def)
(function (_ writer)
(let [=method (ClassWriter::visitMethod ($_ i/+
(visibility-flag visibility)
@@ -225,8 +225,8 @@
writer)))
(def: #export (abstract-method visibility config name type)
- (-> $.Visibility $.Method-Config Text Method
- $.Def)
+ (-> //.Visibility //.Method-Config Text Method
+ //.Def)
(function (_ writer)
(let [=method (ClassWriter::visitMethod ($_ i/+
(visibility-flag visibility)
@@ -241,7 +241,7 @@
writer)))
(def: #export (field visibility config name type)
- (-> $.Visibility $.Field-Config Text Type $.Def)
+ (-> //.Visibility //.Field-Config Text Type //.Def)
(function (_ writer)
(let [=field (do-to (ClassWriter::visitField ($_ i/+
(visibility-flag visibility)
@@ -256,7 +256,7 @@
(template [<name> <lux-type> <jvm-type> <prepare>]
[(def: #export (<name> visibility config name value)
- (-> $.Visibility $.Field-Config Text <lux-type> $.Def)
+ (-> //.Visibility //.Field-Config Text <lux-type> //.Def)
(function (_ writer)
(let [=field (do-to (ClassWriter::visitField ($_ i/+
(visibility-flag visibility)
@@ -281,7 +281,7 @@
)
(def: #export (fuse defs)
- (-> (List $.Def) $.Def)
+ (-> (List //.Def) //.Def)
(case defs
#.Nil
function.identity
diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
index cf68663a5..ae54dccc7 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
@@ -1055,12 +1055,31 @@
self-name arguments returnT exceptionsT
(normalize-method-body local-mapping body)]))
overriden-methods)]
+ method-definitions (|> normalized-methods
+ (monad.map @ (function (_ [ownerT name
+ strict-fp? annotations vars
+ self-name arguments returnT exceptionsT
+ bodyS])
+ (do @
+ [bodyG (generate bodyS)]
+ (wrap (_def.method #$.Public
+ (if strict-fp?
+ ($_ $.++M $.finalM $.strictM)
+ $.finalM)
+ name
+ (jvm.method (list@map product.right arguments)
+ returnT
+ (list@map (|>> #jvm.Class)
+ exceptionsT))
+ bodyG)))))
+ (:: @ map _def.fuse))
_ (generation.save! true ["" class-name]
[class-name
(_def.class #$.V1_6 #$.Public $.finalC
class-name (list)
super-class super-interfaces
- (|>> (///function.with-environment total-environment)))])]
+ (|>> (///function.with-environment total-environment)
+ method-definitions))])]
(anonymous-instance class-name total-environment)))]))
(def: bundle::class