aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2016-10-28 19:40:21 -0400
committerEduardo Julian2016-10-28 19:40:21 -0400
commit75543cbbc31313701087ed10d1a99e5a1eaedb74 (patch)
treea612ea9e9675da323e0279b61c88149dd6073e58
parent7cbe516e7e3c56f249515744d76fbc3ee9653068 (diff)
- Fixed the bug that caused trouble between caching and parallel compilation.
Diffstat (limited to '')
-rw-r--r--src/lux/compiler/cache.clj16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lux/compiler/cache.clj b/src/lux/compiler/cache.clj
index 4f90c7cce..374993a7a 100644
--- a/src/lux/compiler/cache.clj
+++ b/src/lux/compiler/cache.clj
@@ -76,6 +76,17 @@
bytecode (read-file file)]
(swap! !classes assoc (str module* "." real-name) bytecode))))
+(defn ^:private assume-async-result
+ "(-> (Error Compiler) (Lux Null))"
+ [result]
+ (fn [_]
+ (|case result
+ (&/$Left error)
+ (&/$Left error)
+
+ (&/$Right compiler)
+ (return* compiler nil))))
+
(let [->regex (fn [text] (re-pattern (java.util.regex.Pattern/quote text)))
entry-separator-re (->regex &&/entry-separator)
field-separator-re (->regex &&/field-separator)
@@ -88,8 +99,9 @@
(|do [already-loaded? (&a-module/exists? module)]
(if already-loaded?
(return module-hash)
- (|let [redo-cache (|do [_ (delete module)]
- (compile-module module))]
+ (|let [redo-cache (|do [_ (delete module)
+ async (compile-module module)]
+ (assume-async-result @async))]
(if (cached? module)
(|do [loader &/loader
!classes &/classes