From bcd3d9ee8f6797f758a2abea98d5cb6a74cc7df0 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 15 Jun 2018 00:11:33 -0400 Subject: - WIP: Adjustments to new-luxc based on recent changes to stdlib. --- new-luxc/source/luxc/lang/host/jvm/type.lux | 134 ++++++++++++++-------------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'new-luxc/source/luxc/lang/host/jvm/type.lux') diff --git a/new-luxc/source/luxc/lang/host/jvm/type.lux b/new-luxc/source/luxc/lang/host/jvm/type.lux index b29ffc4a0..0c36e6799 100644 --- a/new-luxc/source/luxc/lang/host/jvm/type.lux +++ b/new-luxc/source/luxc/lang/host/jvm/type.lux @@ -1,123 +1,123 @@ (.module: - [lux #- char] + [lux #- int char] (lux (data [text] text/format (coll [list "list/" Functor]))) - ["$" //]) + [//]) ## Types (do-template [ ] - [(def: #export $.Type (#$.Primitive ))] - - [boolean #$.Boolean] - [byte #$.Byte] - [short #$.Short] - [int #$.Int] - [long #$.Long] - [float #$.Float] - [double #$.Double] - [char #$.Char] + [(def: #export //.Type (#//.Primitive ))] + + [boolean #//.Boolean] + [byte #//.Byte] + [short #//.Short] + [int #//.Int] + [long #//.Long] + [float #//.Float] + [double #//.Double] + [char #//.Char] ) (def: #export (class name params) - (-> Text (List $.Generic) $.Type) - (#$.Generic (#$.Class name params))) + (-> Text (List //.Generic) //.Type) + (#//.Generic (#//.Class name params))) (def: #export (var name) - (-> Text $.Type) - (#$.Generic (#$.Var name))) + (-> Text //.Type) + (#//.Generic (#//.Var name))) (def: #export (wildcard bound) - (-> (Maybe [$.Bound $.Generic]) $.Type) - (#$.Generic (#$.Wildcard bound))) + (-> (Maybe [//.Bound //.Generic]) //.Type) + (#//.Generic (#//.Wildcard bound))) (def: #export (array depth elemT) - (-> Nat $.Type $.Type) + (-> Nat //.Type //.Type) (case depth +0 elemT - _ (#$.Array (array (n/dec depth) elemT)))) + _ (#//.Array (array (dec depth) elemT)))) (def: #export (binary-name class) (-> Text Text) (text.replace-all "." "/" class)) (def: #export (descriptor type) - (-> $.Type Text) + (-> //.Type Text) (case type - (#$.Primitive prim) + (#//.Primitive prim) (case prim - #$.Boolean "Z" - #$.Byte "B" - #$.Short "S" - #$.Int "I" - #$.Long "J" - #$.Float "F" - #$.Double "D" - #$.Char "C") - - (#$.Array sub) + #//.Boolean "Z" + #//.Byte "B" + #//.Short "S" + #//.Int "I" + #//.Long "J" + #//.Float "F" + #//.Double "D" + #//.Char "C") + + (#//.Array sub) (format "[" (descriptor sub)) - (#$.Generic generic) + (#//.Generic generic) (case generic - (#$.Class class params) + (#//.Class class params) (format "L" (binary-name class) ";") - (^or (#$.Var name) (#$.Wildcard ?bound)) - (descriptor (#$.Generic (#$.Class "java.lang.Object" (list))))) + (^or (#//.Var name) (#//.Wildcard ?bound)) + (descriptor (#//.Generic (#//.Class "java.lang.Object" (list))))) )) (def: #export (signature type) - (-> $.Type Text) + (-> //.Type Text) (case type - (#$.Primitive prim) + (#//.Primitive prim) (case prim - #$.Boolean "Z" - #$.Byte "B" - #$.Short "S" - #$.Int "I" - #$.Long "J" - #$.Float "F" - #$.Double "D" - #$.Char "C") - - (#$.Array sub) + #//.Boolean "Z" + #//.Byte "B" + #//.Short "S" + #//.Int "I" + #//.Long "J" + #//.Float "F" + #//.Double "D" + #//.Char "C") + + (#//.Array sub) (format "[" (signature sub)) - (#$.Generic generic) + (#//.Generic generic) (case generic - (#$.Class class params) + (#//.Class class params) (let [=params (if (list.empty? params) "" (format "<" (|> params - (list/map (|>> #$.Generic signature)) + (list/map (|>> #//.Generic signature)) (text.join-with "")) ">"))] (format "L" (binary-name class) =params ";")) - (#$.Var name) + (#//.Var name) (format "T" name ";") - (#$.Wildcard #.None) + (#//.Wildcard #.None) "*" (^template [ ] - (#$.Wildcard (#.Some [ bound])) - (format (signature (#$.Generic bound)))) - ([#$.Upper "+"] - [#$.Lower "-"])) + (#//.Wildcard (#.Some [ bound])) + (format (signature (#//.Generic bound)))) + ([#//.Upper "+"] + [#//.Lower "-"])) )) ## Methods (def: #export (method args return exceptions) - (-> (List $.Type) (Maybe $.Type) (List $.Generic) $.Method) - {#$.args args #$.return return #$.exceptions exceptions}) + (-> (List //.Type) (Maybe //.Type) (List //.Generic) //.Method) + {#//.args args #//.return return #//.exceptions exceptions}) (def: #export (method-descriptor method) - (-> $.Method Text) - (format "(" (text.join-with "" (list/map descriptor (get@ #$.args method))) ")" - (case (get@ #$.return method) + (-> //.Method Text) + (format "(" (text.join-with "" (list/map descriptor (get@ #//.args method))) ")" + (case (get@ #//.return method) #.None "V" @@ -125,14 +125,14 @@ (descriptor return)))) (def: #export (method-signature method) - (-> $.Method Text) - (format "(" (|> (get@ #$.args method) (list/map signature) (text.join-with "")) ")" - (case (get@ #$.return method) + (-> //.Method Text) + (format "(" (|> (get@ #//.args method) (list/map signature) (text.join-with "")) ")" + (case (get@ #//.return method) #.None "V" (#.Some return) (signature return)) - (|> (get@ #$.exceptions method) - (list/map (|>> #$.Generic signature (format "^"))) + (|> (get@ #//.exceptions method) + (list/map (|>> #//.Generic signature (format "^"))) (text.join-with "")))) -- cgit v1.2.3