aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/host.jvm.lux53
-rw-r--r--stdlib/source/lux/world/blob.jvm.lux6
-rw-r--r--stdlib/source/lux/world/fs.jvm.lux4
-rw-r--r--stdlib/source/lux/world/net/tcp.jvm.lux4
-rw-r--r--stdlib/source/lux/world/net/udp.jvm.lux4
5 files changed, 22 insertions, 49 deletions
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index ef4844d88..ece9583b9 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -1,5 +1,5 @@
(;module:
- lux
+ [lux #- type]
(lux (control ["M" monad #+ do Monad]
[enum]
["p" parser])
@@ -65,20 +65,6 @@
(def: member-separator ".")
## Types
-(do-template [<class> <name>]
- [(type: #export <name>
- (#;Host <class> #;Nil))]
-
- ["[Z" Boolean-Array]
- ["[B" Byte-Array]
- ["[S" Short-Array]
- ["[I" Int-Array]
- ["[J" Long-Array]
- ["[F" Float-Array]
- ["[D" Double-Array]
- ["[C" Char-Array]
- )
-
(type: JVM-Code Text)
(type: BoundKind
@@ -683,26 +669,9 @@
(wrap (#GenericWildcard (#;Some [bound-kind bound])))))
(do p;Monad<Parser>
[name (full-class-name^ imports)]
- (with-expansions
- [<branches> (do-template [<class> <name>]
- [(Text/= <name> name)
- (wrap (#GenericClass <class> (list)))]
-
- ["[Z" "Boolean-Array"]
- ["[B" "Byte-Array"]
- ["[S" "Short-Array"]
- ["[I" "Int-Array"]
- ["[J" "Long-Array"]
- ["[F" "Float-Array"]
- ["[D" "Double-Array"]
- ["[C" "Char-Array"])]
- (cond (list;member? text;Eq<Text> (L/map product;left type-vars) name)
- (wrap (#GenericTypeVar name))
-
- <branches>
-
- ## else
- (wrap (#GenericClass name (list))))))
+ (if (list;member? text;Eq<Text> (L/map product;left type-vars) name)
+ (wrap (#GenericTypeVar name))
+ (wrap (#GenericClass name (list)))))
(s;form (do p;Monad<Parser>
[name (s;this (' Array))
component (generic-type^ imports type-vars)]
@@ -1300,9 +1269,9 @@
(class-imports *compiler*))]]
[#let [class-vars (product;right class-decl)]]
[super (p;default object-super-class
- (super-class-decl^ imports class-vars))]
+ (super-class-decl^ imports class-vars))]
[interfaces (p;default (list)
- (s;tuple (p;some (super-class-decl^ imports class-vars))))]
+ (s;tuple (p;some (super-class-decl^ imports class-vars))))]
[annotations (annotations^ imports)]
[fields (p;some (field-decl^ imports class-vars))]
[methods (p;some (method-def^ imports class-vars))])
@@ -1361,7 +1330,7 @@
(class-imports *compiler*))]]
[#let [class-vars (product;right class-decl)]]
[supers (p;default (list)
- (s;tuple (p;some (super-class-decl^ imports class-vars))))]
+ (s;tuple (p;some (super-class-decl^ imports class-vars))))]
[annotations (annotations^ imports)]
[members (p;some (method-decl^ imports class-vars))])
{#;doc (doc "Allows defining JVM interfaces."
@@ -1378,9 +1347,9 @@
(syntax: #export (object [#let [imports (class-imports *compiler*)]]
[#let [class-vars (list)]]
[super (p;default object-super-class
- (super-class-decl^ imports class-vars))]
+ (super-class-decl^ imports class-vars))]
[interfaces (p;default (list)
- (s;tuple (p;some (super-class-decl^ imports class-vars))))]
+ (s;tuple (p;some (super-class-decl^ imports class-vars))))]
[constructor-args (constructor-args^ imports class-vars)]
[methods (p;some (overriden-method-def^ imports))])
{#;doc (doc "Allows defining anonymous classes."
@@ -2106,3 +2075,7 @@
#;None
(macro;fail (Text/append "Unknown class: " class)))))
+
+(syntax: #export (type [#let [imports (class-imports *compiler*)]]
+ [type (generic-type^ imports (list))])
+ (wrap (list (class->type #ManualPrM (list) type))))
diff --git a/stdlib/source/lux/world/blob.jvm.lux b/stdlib/source/lux/world/blob.jvm.lux
index 249cee9eb..4d35a5658 100644
--- a/stdlib/source/lux/world/blob.jvm.lux
+++ b/stdlib/source/lux/world/blob.jvm.lux
@@ -12,11 +12,11 @@
(exception: #export Index-Out-Of-Bounds)
(exception: #export Inverted-Range)
-(type: #export Blob host;Byte-Array)
+(type: #export Blob (host;type (Array byte)))
(host;import java.util.Arrays
- (#static copyOfRange [Byte-Array int int] Byte-Array)
- (#static equals [Byte-Array Byte-Array] boolean))
+ (#static copyOfRange [(Array byte) int int] (Array byte))
+ (#static equals [(Array byte) (Array byte)] boolean))
(def: byte-mask
Nat
diff --git a/stdlib/source/lux/world/fs.jvm.lux b/stdlib/source/lux/world/fs.jvm.lux
index 44f028f0b..4c0881e04 100644
--- a/stdlib/source/lux/world/fs.jvm.lux
+++ b/stdlib/source/lux/world/fs.jvm.lux
@@ -37,14 +37,14 @@
(close [] #io #try void))
(host;import java.io.OutputStream
- (write [Byte-Array] #io #try void)
+ (write [(Array byte)] #io #try void)
(flush [] #io #try void))
(host;import java.io.FileOutputStream
(new [java.io.File boolean] #io #try))
(host;import java.io.InputStream
- (read [Byte-Array] #io #try int))
+ (read [(Array byte)] #io #try int))
(host;import java.io.FileInputStream
(new [java.io.File] #io #try))
diff --git a/stdlib/source/lux/world/net/tcp.jvm.lux b/stdlib/source/lux/world/net/tcp.jvm.lux
index 25d6bb6ae..fec65e387 100644
--- a/stdlib/source/lux/world/net/tcp.jvm.lux
+++ b/stdlib/source/lux/world/net/tcp.jvm.lux
@@ -18,10 +18,10 @@
(flush [] #io #try void))
(host;import java.io.InputStream
- (read [Byte-Array int int] #io #try int))
+ (read [(Array byte) int int] #io #try int))
(host;import java.io.OutputStream
- (write [Byte-Array int int] #io #try void))
+ (write [(Array byte) int int] #io #try void))
(host;import java.net.Socket
(new [String int] #io #try)
diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux
index f9bf5eec4..92715a9b7 100644
--- a/stdlib/source/lux/world/net/udp.jvm.lux
+++ b/stdlib/source/lux/world/net/udp.jvm.lux
@@ -25,8 +25,8 @@
(getHostAddress [] String))
(host;import java.net.DatagramPacket
- (new #as new|send [Byte-Array int int InetAddress int])
- (new #as new|receive [Byte-Array int int])
+ (new #as new|send [(Array byte) int int InetAddress int])
+ (new #as new|receive [(Array byte) int int])
(getAddress [] InetAddress)
(getPort [] int)
(getLength [] int))