diff options
author | Eduardo Julian | 2018-04-06 08:32:41 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-04-06 08:32:41 -0400 |
commit | ca238f9c89d3156842b0a3d5fe24a5d69b2eedb0 (patch) | |
tree | 50ba106541f2357daf27393df28e8b263f7311e1 /new-luxc/source/luxc/cache/io.lux | |
parent | 84d7e87817cd2c074653b34d028c8fa807febc7f (diff) |
- Adapted new-luxc's code to latest stdlib changes.
Diffstat (limited to 'new-luxc/source/luxc/cache/io.lux')
-rw-r--r-- | new-luxc/source/luxc/cache/io.lux | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/new-luxc/source/luxc/cache/io.lux b/new-luxc/source/luxc/cache/io.lux index 9f5474c76..8c4367989 100644 --- a/new-luxc/source/luxc/cache/io.lux +++ b/new-luxc/source/luxc/cache/io.lux @@ -21,11 +21,16 @@ [//influences] [//]) -(exception: #export Invalid-Lux-Version) -(exception: #export Module-Is-Not-Cached) -(exception: #export Cannot-Pre-Load-Cache-More-Than-Once) -(exception: #export Cannot-Delete-Cached-File) -(exception: #export Cannot-Load-Definition) +(do-template [<name>] + [(exception: #export (<name> {message Text}) + message)] + + [Invalid-Lux-Version] + [Module-Is-Not-Cached] + [Cannot-Pre-Load-Cache-More-Than-Once] + [Cannot-Delete-Cached-File] + [Cannot-Load-Definition] + ) (def: cache (Atom //.Cache) @@ -47,7 +52,7 @@ (do io.Monad<Process> [roots (file.files target-dir) root-modules (monad.map @ (: (-> File (Process (List File))) - (function recur [file] + (function (recur file) (do @ [is-dir? (file.directory? file)] (if is-dir? @@ -74,7 +79,7 @@ [#let [module-dir (///io.file target-dir module-name)] files (file.files module-dir) can-delete-module-dir? (<| (:: @ map (list.every? (bool/= true))) - (monad.map @ (function [file] + (monad.map @ (function (_ file) (do @ [? (file.directory? file)] (if ? @@ -129,7 +134,7 @@ (-> File Loader Text Module (Process Module)) (do io.Monad<Process> [definitions (monad.map @ (: (-> [Text Definition] (Process [Text Definition])) - (function [[def-name [def-type def-annotations _]]] + (function (_ [def-name [def-type def-annotations _]]) (do @ [def-blob (file.read (///io.file target-dir (format module-name "/" def-name))) #let [def-ident [module-name def-name]]] @@ -156,21 +161,21 @@ (dict.from-list text.Hash<Text>)))) #let [_ (log! "pre-load' #2")] #let [candidate-entries (dict.entries candidate-cache) - raw-influences (list/fold (function [[candidate-name candidate-module] influences] + raw-influences (list/fold (function (_ [candidate-name candidate-module] influences) (list/fold (//influences.track candidate-name) influences (get@ #.imports candidate-module))) //influences.empty candidate-entries) - pruned-influences (list/fold (function [[candidate-name candidate-module] influences] - (if (list.every? (function [module-name] + pruned-influences (list/fold (function (_ [candidate-name candidate-module] influences) + (if (list.every? (function (_ module-name) (dict.contains? module-name candidate-cache)) (get@ #.imports candidate-module)) influences (//influences.untrack candidate-name influences))) raw-influences candidate-entries) - valid-cache (list/fold (function [candidate cache] + valid-cache (list/fold (function (_ candidate cache) (if (dict.contains? candidate pruned-influences) cache (dict.remove candidate cache))) @@ -178,7 +183,7 @@ (dict.keys candidate-cache))] #let [_ (log! "pre-load' #3")]] (|> (dict.entries valid-cache) - (monad.map @ (function [[module-name module]] + (monad.map @ (function (_ [module-name module]) (do @ [#let [_ (log! (format " PRE INSTALL: " module-name))] loaded-module (install target-dir load-def module-name module) |