aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/host.js.lux34
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux45
-rw-r--r--stdlib/source/lux/tool/compiler/language/lux/phase/synthesis.lux3
-rw-r--r--stdlib/source/lux/tool/compiler/meta/packager/script.lux33
-rw-r--r--stdlib/source/lux/world/file.lux2
-rw-r--r--stdlib/source/program/compositor.lux45
6 files changed, 93 insertions, 69 deletions
diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux
index eb0da3594..8dd6f1ad8 100644
--- a/stdlib/source/lux/host.js.lux
+++ b/stdlib/source/lux/host.js.lux
@@ -57,11 +57,16 @@
(<c>.form (<>.after (<c>.this! (' new))
(<c>.tuple (<>.some ..nullable)))))
-(type: Field [Text Nullable])
+(type: Field [Bit Text Nullable])
+
+(def: static!
+ (Parser Any)
+ (<c>.this! (' #static)))
(def: field
(Parser Field)
(<c>.form ($_ <>.and
+ (<>.parses? ..static!)
<c>.local-identifier
..nullable)))
@@ -83,12 +88,12 @@
..nullable))
(def: static-method
- (<c>.form (<>.after (<c>.this! (' #static)) ..common-method)))
+ (<>.after ..static! ..common-method))
(def: method
(Parser Method)
- (<>.or ..static-method
- (<c>.form ..common-method)))
+ (<c>.form (<>.or ..static-method
+ ..common-method)))
(type: Member
(#Constructor Constructor)
@@ -144,7 +149,7 @@
($_ <>.and
<c>.local-identifier
(<>.some member))
- ..static-method
+ (<c>.form ..common-method)
))
(syntax: #export (try expression)
@@ -207,13 +212,18 @@
("js constant" (~ (code.text real-class)))
[(~+ (list@map (with-null g!temp) g!inputs))])))))
- (#Field [field fieldT])
- (` (def: ((~ (qualify field))
- (~ g!object))
- (-> (~ g!type)
- (~ (nullable-type fieldT)))
- (:assume
- (~ (without-null g!temp fieldT (` ("js object get" (~ (code.text field)) (~ g!object))))))))
+ (#Field [static? field fieldT])
+ (if static?
+ (` ((~! syntax:) ((~ (qualify field)))
+ (:: (~! macro.monad) (~' wrap)
+ (list (` (.:coerce (~ (nullable-type fieldT))
+ ("js constant" (~ (code.text (format real-class "." field))))))))))
+ (` (def: ((~ (qualify field))
+ (~ g!object))
+ (-> (~ g!type)
+ (~ (nullable-type fieldT)))
+ (:assume
+ (~ (without-null g!temp fieldT (` ("js object get" (~ (code.text field)) (~ g!object)))))))))
(#Method method)
(case method
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
index fa9307f90..b87e6b901 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux
@@ -14,7 +14,7 @@
[collection
["." list ("#@." functor)]
["." dictionary]]]
- [target
+ ["@" target
["_" js (#+ Literal Expression Statement)]]]
["." //// #_
["/" bundle]
@@ -57,19 +57,36 @@
)
## [[Numbers]]
-(import: #long java/lang/Double
- (#static MIN_VALUE double)
- (#static MAX_VALUE double))
-
-(template [<name> <const>]
- [(def: (<name> _)
- (Nullary Expression)
- (//primitive.f64 <const>))]
-
- [f64//smallest (java/lang/Double::MIN_VALUE)]
- [f64//min (f.* -1.0 (java/lang/Double::MAX_VALUE))]
- [f64//max (java/lang/Double::MAX_VALUE)]
- )
+(for {@.old
+ (as-is (import: #long java/lang/Double
+ (#static MIN_VALUE double)
+ (#static MAX_VALUE double))
+
+ (template [<name> <const>]
+ [(def: (<name> _)
+ (Nullary Expression)
+ (//primitive.f64 <const>))]
+
+ [f64//smallest (java/lang/Double::MIN_VALUE)]
+ [f64//min (f.* -1.0 (java/lang/Double::MAX_VALUE))]
+ [f64//max (java/lang/Double::MAX_VALUE)]
+ ))
+
+ @.js
+ (as-is (import: Number
+ (#static MIN_VALUE Frac)
+ (#static MAX_VALUE Frac))
+
+ (template [<name> <const>]
+ [(def: (<name> _)
+ (Nullary Expression)
+ (//primitive.f64 <const>))]
+
+ [f64//smallest (Number::MIN_VALUE)]
+ [f64//min (f.* -1.0 (Number::MAX_VALUE))]
+ [f64//max (Number::MAX_VALUE)]
+ )
+ )})
(def: f64//decode
(Unary Expression)
diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis.lux
index 54f299c31..497261cf0 100644
--- a/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis.lux
+++ b/stdlib/source/lux/tool/compiler/language/lux/phase/synthesis.lux
@@ -20,7 +20,8 @@
["#." analysis (#+ Analysis)]
["/" synthesis (#+ Synthesis Phase)]
[///
- [reference (#+)]
+ [reference (#+)
+ [variable (#+)]]
["." phase ("#@." monad)]]]]])
(def: (primitive analysis)
diff --git a/stdlib/source/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/lux/tool/compiler/meta/packager/script.lux
index 88a7ddef0..bbbba4978 100644
--- a/stdlib/source/lux/tool/compiler/meta/packager/script.lux
+++ b/stdlib/source/lux/tool/compiler/meta/packager/script.lux
@@ -1,29 +1,20 @@
(.module:
- [lux (#- Module Definition)
+ [lux #*
[type (#+ :share)]
- ["." host (#+ import: do-to)]
[abstract
["." monad (#+ Monad do)]]
[control
["." try (#+ Try)]
- [concurrency
- ["." promise (#+ Promise)]]
[security
["!" capability]]]
[data
- ["." binary (#+ Binary)]
- ["." text
+ [binary (#+ Binary)]
+ [text
["%" format (#+ format)]
["." encoding]]
- [number
- ["n" nat]]
[collection
- ["." row (#+ Row)]
- ["." list ("#@." functor fold)]]]
- [target
- [jvm
- [encoding
- ["." name]]]]
+ ["." row]
+ ["." list ("#@." functor)]]]
[world
["." file (#+ File Directory)]]]
[program
@@ -32,7 +23,7 @@
["." // (#+ Packager)
[//
["." archive
- ["." descriptor (#+ Module)]
+ ["." descriptor]
["." artifact]]
[cache
["." dependency]]
@@ -41,11 +32,7 @@
[//
[language
["$" lux
- [generation (#+ Context)]
- [phase
- [generation
- [jvm
- ["." runtime (#+ Definition)]]]]]]]]])
+ [generation (#+ Context)]]]]]])
## TODO: Delete ASAP
(type: (Action ! a)
@@ -86,11 +73,7 @@
(Packager !)))
(function (package monad file-system static archive program)
(do {@ (try.with monad)}
- [cache (:share [!]
- {(Monad !)
- monad}
- {(! (Try (Directory !)))
- (:assume (!.use (:: file-system directory) [(get@ #static.target static)]))})
+ [cache (!.use (:: file-system directory) [(get@ #static.target static)])
order (:: monad wrap (dependency.load-order $.key archive))]
(|> order
(list@map (function (_ [module [module-id [descriptor document]]])
diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux
index 4fd43bf15..3a976918f 100644
--- a/stdlib/source/lux/world/file.lux
+++ b/stdlib/source/lux/world/file.lux
@@ -453,7 +453,7 @@
(sep host.String)
(basename [host.String] host.String))
- (import: (#static require [host.String] Any))
+ (import: (require [host.String] Any))
(template: (!fs)
(:coerce ..Fs (..require "fs")))
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index 63c398bf9..95ad2c771 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -24,7 +24,8 @@
["." list ("#@." functor fold)]]]
[world
["." file (#+ File Path)]
- ["." console]]
+ ## ["." console]
+ ]
[tool
[compiler
["." phase]
@@ -73,21 +74,33 @@
(def: (package! monad file-system [packager package] static archive context)
(All [!] (-> (Monad !) (file.System !) [Packager Path] Static Archive Context (! (Try Any))))
- (do (try.with monad)
- [#let [packager (:share [!] {(Monad !) monad} {(Packager !) packager})]
- content (packager monad file-system static archive context)
- package (:share [!]
- {(Monad !)
- monad}
- {(! (Try (File !)))
- (:assume (file.get-file monad file-system package))})]
- (!.use (:: (:share [!]
- {(Monad !)
- monad}
- {(File !)
- (:assume package)})
- over-write)
- [content])))
+ (for {@.old
+ (do (try.with monad)
+ [#let [packager (:share [!] {(Monad !) monad} {(Packager !) packager})]
+ content (packager monad file-system static archive context)
+ package (:share [!]
+ {(Monad !)
+ monad}
+ {(! (Try (File !)))
+ (:assume (file.get-file monad file-system package))})]
+ (!.use (:: (:share [!]
+ {(Monad !)
+ monad}
+ {(File !)
+ (:assume package)})
+ over-write)
+ [content]))}
+ ## TODO: Fix whatever type-checker bug is forcing me into this compromise...
+ (:assume
+ (: (Promise (Try Any))
+ (let [monad (:coerce (Monad Promise) monad)
+ file-system (:coerce (file.System Promise) monad)
+ packager (:coerce (Packager Promise) packager)]
+ (do (try.with monad)
+ [content (packager monad file-system static archive context)
+ package (: (Promise (Try (File Promise)))
+ (file.get-file monad file-system package))]
+ (!.use (:: (: (File Promise) package) over-write) [content])))))))
(with-expansions [<parameters> (as-is anchor expression artifact)]
(def: #export (compiler static