diff options
author | Eduardo Julian | 2018-06-15 00:11:33 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-06-15 00:11:33 -0400 |
commit | bcd3d9ee8f6797f758a2abea98d5cb6a74cc7df0 (patch) | |
tree | b122b9ecf2d5333ba97cffbadfeee00eba2e1cf8 /new-luxc/source/luxc/lang/host/jvm/type.lux | |
parent | 0190e084c6f44be32ea2bc5a89ef55b52bdc789b (diff) |
- WIP: Adjustments to new-luxc based on recent changes to stdlib.
Diffstat (limited to 'new-luxc/source/luxc/lang/host/jvm/type.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/host/jvm/type.lux | 134 |
1 files changed, 67 insertions, 67 deletions
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<List>]))) - ["$" //]) + [//]) ## Types (do-template [<name> <primitive>] - [(def: #export <name> $.Type (#$.Primitive <primitive>))] - - [boolean #$.Boolean] - [byte #$.Byte] - [short #$.Short] - [int #$.Int] - [long #$.Long] - [float #$.Float] - [double #$.Double] - [char #$.Char] + [(def: #export <name> //.Type (#//.Primitive <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 [<tag> <prefix>] - (#$.Wildcard (#.Some [<tag> bound])) - (format <prefix> (signature (#$.Generic bound)))) - ([#$.Upper "+"] - [#$.Lower "-"])) + (#//.Wildcard (#.Some [<tag> bound])) + (format <prefix> (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 "")))) |