aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool
diff options
context:
space:
mode:
authorEduardo Julian2021-06-24 03:42:57 -0400
committerEduardo Julian2021-06-24 03:42:57 -0400
commitce1a7a131f7c4df8eae5c019eba2893b56f04d46 (patch)
tree645c4b42c4b9bff141b7390d9f33f3f1fe4aeea1 /stdlib/source/lux/tool
parenta82bd1eabe94763162c2b0707d9c198fbe9835e3 (diff)
Added a macro for type-casting JVM objects.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/tool/compiler/default/platform.lux7
-rw-r--r--stdlib/source/lux/tool/compiler/meta/io/archive.lux6
-rw-r--r--stdlib/source/lux/tool/compiler/meta/io/context.lux50
3 files changed, 34 insertions, 29 deletions
diff --git a/stdlib/source/lux/tool/compiler/default/platform.lux b/stdlib/source/lux/tool/compiler/default/platform.lux
index d505f5f7c..d43259443 100644
--- a/stdlib/source/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/lux/tool/compiler/default/platform.lux
@@ -340,7 +340,7 @@
<Signal> (as_is (Resolver <Result>))
<Pending> (as_is [<Return> <Signal>])
<Importer> (as_is (-> Module Module <Return>))
- <Compiler> (as_is (-> <Importer> archive.ID <Context> Module <Return>))]
+ <Compiler> (as_is (-> Module <Importer> archive.ID <Context> Module <Return>))]
(def: (parallel initial)
(All [<type_vars>]
(-> <Context>
@@ -420,7 +420,7 @@
(#.Some [context module_id resolver])
(do !
- [result (compile import! module_id context module)
+ [result (compile importer import! module_id context module)
result (case result
(#try.Failure error)
(wrap result)
@@ -487,10 +487,11 @@
((//init.compiler expander syntax.prelude (get@ #write platform)) $.key (list))))
compiler (..parallel
context
- (function (_ import! module_id [archive state] module)
+ (function (_ importer import! module_id [archive state] module)
(do {! (try.with promise.monad)}
[#let [state (..set_current_module module state)]
input (context.read (get@ #&file_system platform)
+ importer
import
compilation_sources
(get@ #static.host_module_extension static)
diff --git a/stdlib/source/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/lux/tool/compiler/meta/io/archive.lux
index 7fe4b96a9..e611f9f47 100644
--- a/stdlib/source/lux/tool/compiler/meta/io/archive.lux
+++ b/stdlib/source/lux/tool/compiler/meta/io/archive.lux
@@ -384,6 +384,10 @@
(..initial_purge caches)
load_order))
+(def: pseudo_module
+ Text
+ "(Lux Caching System)")
+
(def: (load_every_reserved_module host_environment system static import contexts archive)
(All [expression directive]
(-> (generation.Host expression directive) (file.System Promise) Static Import (List Context) Archive
@@ -399,7 +403,7 @@
(wrap [true
[module_name [module_id [descriptor document (: Output row.empty)]]]])
(do !
- [input (//context.read system import contexts (get@ #static.host_module_extension static) module_name)]
+ [input (//context.read system ..pseudo_module import contexts (get@ #static.host_module_extension static) module_name)]
(wrap [(..valid_cache? descriptor input)
[module_name [module_id [descriptor document (: Output row.empty)]]]])))))))
load_order (|> pre_loaded_caches
diff --git a/stdlib/source/lux/tool/compiler/meta/io/context.lux b/stdlib/source/lux/tool/compiler/meta/io/context.lux
index 3bb388f5e..33f201571 100644
--- a/stdlib/source/lux/tool/compiler/meta/io/context.lux
+++ b/stdlib/source/lux/tool/compiler/meta/io/context.lux
@@ -30,14 +30,14 @@
[descriptor (#+ Module)]]
["/#" // (#+ Input)]]])
-(template [<name>]
- [(exception: #export (<name> {module Module})
- (exception.report
- ["Module" (%.text module)]))]
+(exception: #export (cannot_find_module {importer Module} {module Module})
+ (exception.report
+ ["Module" (%.text module)]
+ ["Importer" (%.text importer)]))
- [cannot_find_module]
- [cannot_read_module]
- )
+(exception: #export (cannot_read_module {module Module})
+ (exception.report
+ ["Module" (%.text module)]))
(type: #export Extension
Text)
@@ -52,12 +52,12 @@
(//.sanitize system)
(format context (\ system separator))))
-(def: (find_source_file system contexts module extension)
- (-> (file.System Promise) (List Context) Module Extension
+(def: (find_source_file system importer contexts module extension)
+ (-> (file.System Promise) Module (List Context) Module Extension
(Promise (Try [Path (File Promise)])))
(case contexts
#.Nil
- (promise\wrap (exception.throw ..cannot_find_module [module]))
+ (promise\wrap (exception.throw ..cannot_find_module [importer module]))
(#.Cons context contexts')
(do promise.monad
@@ -68,19 +68,19 @@
(wrap (#try.Success [path file]))
(#try.Failure _)
- (find_source_file system contexts' module extension)))))
+ (find_source_file system importer contexts' module extension)))))
(def: (full_host_extension partial_host_extension)
(-> Extension Extension)
(format partial_host_extension ..lux_extension))
-(def: (find_local_source_file system import contexts partial_host_extension module)
- (-> (file.System Promise) Import (List Context) Extension Module
+(def: (find_local_source_file system importer import contexts partial_host_extension module)
+ (-> (file.System Promise) Module Import (List Context) Extension Module
(Promise (Try [Path Binary])))
## Preference is explicitly being given to Lux files that have a host extension.
## Normal Lux files (i.e. without a host extension) are then picked as fallback files.
(do {! promise.monad}
- [outcome (..find_source_file system contexts module (..full_host_extension partial_host_extension))]
+ [outcome (..find_source_file system importer contexts module (..full_host_extension partial_host_extension))]
(case outcome
(#try.Success [path file])
(do (try.with !)
@@ -89,12 +89,12 @@
(#try.Failure _)
(do (try.with !)
- [[path file] (..find_source_file system contexts module ..lux_extension)
+ [[path file] (..find_source_file system importer contexts module ..lux_extension)
data (!.use (\ file content) [])]
(wrap [path data])))))
-(def: (find_library_source_file import partial_host_extension module)
- (-> Import Extension Module (Try [Path Binary]))
+(def: (find_library_source_file importer import partial_host_extension module)
+ (-> Module Import Extension Module (Try [Path Binary]))
(let [path (format module (..full_host_extension partial_host_extension))]
(case (dictionary.get path import)
(#.Some data)
@@ -107,27 +107,27 @@
(#try.Success [path data])
#.None
- (exception.throw ..cannot_find_module [module]))))))
+ (exception.throw ..cannot_find_module [importer module]))))))
-(def: (find_any_source_file system import contexts partial_host_extension module)
- (-> (file.System Promise) Import (List Context) Extension Module
+(def: (find_any_source_file system importer import contexts partial_host_extension module)
+ (-> (file.System Promise) Module Import (List Context) Extension Module
(Promise (Try [Path Binary])))
## Preference is explicitly being given to Lux files that have a host extension.
## Normal Lux files (i.e. without a host extension) are then picked as fallback files.
(do {! promise.monad}
- [outcome (find_local_source_file system import contexts partial_host_extension module)]
+ [outcome (find_local_source_file system importer import contexts partial_host_extension module)]
(case outcome
(#try.Success [path data])
(wrap outcome)
(#try.Failure _)
- (wrap (..find_library_source_file import partial_host_extension module)))))
+ (wrap (..find_library_source_file importer import partial_host_extension module)))))
-(def: #export (read system import contexts partial_host_extension module)
- (-> (file.System Promise) Import (List Context) Extension Module
+(def: #export (read system importer import contexts partial_host_extension module)
+ (-> (file.System Promise) Module Import (List Context) Extension Module
(Promise (Try Input)))
(do (try.with promise.monad)
- [[path binary] (..find_any_source_file system import contexts partial_host_extension module)]
+ [[path binary] (..find_any_source_file system importer import contexts partial_host_extension module)]
(case (\ utf8.codec decode binary)
(#try.Success code)
(wrap {#////.module module