From af7f85c4eb724f2888ecce9c8b52d6d3bb1cd807 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 27 Apr 2019 23:41:47 -0400 Subject: Moved JVM type machinery to stdlib. --- new-luxc/source/luxc/lang/host/jvm/def.lux | 38 ++++++++++++++++-------------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'new-luxc/source/luxc/lang/host/jvm/def.lux') diff --git a/new-luxc/source/luxc/lang/host/jvm/def.lux b/new-luxc/source/luxc/lang/host/jvm/def.lux index 012d7ceee..06e6963a3 100644 --- a/new-luxc/source/luxc/lang/host/jvm/def.lux +++ b/new-luxc/source/luxc/lang/host/jvm/def.lux @@ -1,5 +1,6 @@ (.module: - [lux #* + [lux (#- Type) + ["." host (#+ import: do-to)] [control ["." function]] [data @@ -9,9 +10,10 @@ [collection ["." array (#+ Array)] ["." list ("#/." functor)]]] - ["." host (#+ import: do-to)]] - ["$" // - ["$t" type]]) + [target + [jvm + ["$t" type (#+ Method Class Type Parameter)]]]] + ["$" //]) (import: #long java/lang/Object) (import: #long java/lang/String) @@ -70,9 +72,9 @@ output))) (def: exceptions-array - (-> $.Method (Array Text)) - (|>> (get@ #$.exceptions) - (list/map (|>> #$.Generic $t.descriptor)) + (-> Method (Array Text)) + (|>> (get@ #$t.exceptions) + (list/map (|>> #$t.Generic $t.descriptor)) string-array)) (def: (version-flag version) @@ -117,15 +119,15 @@ (if (get@ #$.volatileF config) (Opcodes::ACC_VOLATILE) +0))) (def: class-to-type - (-> $.Class $.Type) - (|>> #$.Class #$.Generic)) + (-> Class Type) + (|>> #$t.Class #$t.Generic)) (def: param-signature - (-> $.Class Text) + (-> Class Text) (|>> class-to-type $t.signature (format ":"))) (def: (formal-param [name super interfaces]) - (-> $.Parameter Text) + (-> Parameter Text) (format name (param-signature super) (|> interfaces @@ -133,7 +135,7 @@ (text.join-with "")))) (def: (parameters-signature parameters super interfaces) - (-> (List $.Parameter) $.Class (List $.Class) + (-> (List Parameter) Class (List Class) Text) (let [formal-params (if (list.empty? parameters) "" @@ -158,7 +160,7 @@ (template [ ] [(def: #export ( 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) @@ -181,11 +183,11 @@ [abstract (Opcodes::ACC_ABSTRACT)] ) -(def: $Object $.Class ["java.lang.Object" (list)]) +(def: $Object Class ["java.lang.Object" (list)]) (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) @@ -205,7 +207,7 @@ (ClassWriter::toByteArray writer))) (def: #export (method visibility config name type then) - (-> $.Visibility $.Method-Config Text $.Method $.Inst + (-> $.Visibility $.Method-Config Text Method $.Inst $.Def) (function (_ writer) (let [=method (ClassWriter::visitMethod ($_ i/+ @@ -223,7 +225,7 @@ writer))) (def: #export (abstract-method visibility config name type) - (-> $.Visibility $.Method-Config Text $.Method + (-> $.Visibility $.Method-Config Text Method $.Def) (function (_ writer) (let [=method (ClassWriter::visitMethod ($_ i/+ @@ -239,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) -- cgit v1.2.3