diff options
author | Eduardo Julian | 2017-12-01 19:21:19 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-12-01 19:21:19 -0400 |
commit | 718a4272074121ed1adb90626076dcc5e9217b2c (patch) | |
tree | 41bb5e76fb3383161b32384afe16af7eaffa240e /luxc/src | |
parent | bfffa9678ead15439e4156635dfb9180e6222d32 (diff) |
- Made it so that module annotations can only be set once now.
Diffstat (limited to 'luxc/src')
-rw-r--r-- | luxc/src/lux/analyser/module.clj | 4 | ||||
-rw-r--r-- | luxc/src/lux/compiler/cache.clj | 16 | ||||
-rw-r--r-- | luxc/src/lux/compiler/core.clj | 11 |
3 files changed, 22 insertions, 9 deletions
diff --git a/luxc/src/lux/analyser/module.clj b/luxc/src/lux/analyser/module.clj index 090165af9..ef89777a4 100644 --- a/luxc/src/lux/analyser/module.clj +++ b/luxc/src/lux/analyser/module.clj @@ -42,7 +42,7 @@ ;; "lux;types" (&/|table) ;; module-annotations - (&/T [(&/T ["" 0 0]) (&/$Record (&/|list))]) + &/$None ;; "module-state" $Active] )) @@ -222,7 +222,7 @@ (&/update$ &/$modules (fn [ms] (&/|update module-name - #(&/set$ $module-annotations anns %) + #(&/set$ $module-annotations (&/$Some anns) %) ms)))) nil))) diff --git a/luxc/src/lux/compiler/cache.clj b/luxc/src/lux/compiler/cache.clj index 678fda334..28cfe53ee 100644 --- a/luxc/src/lux/compiler/cache.clj +++ b/luxc/src/lux/compiler/cache.clj @@ -112,10 +112,15 @@ (|do [_ (delete module)] (return false))) -(defn ^:private install-module [load-def-value module module-hash imports tag-groups module-anns def-entries] +(defn ^:private install-module [load-def-value module module-hash imports tag-groups ?module-anns def-entries] (|do [_ (&a-module/create-module module module-hash) _ (&a-module/flag-cached-module module) - _ (&a-module/set-anns module-anns module) + _ (|case ?module-anns + (&/$Some module-anns) + (&a-module/set-anns module-anns module) + + (&/$None _) + (return nil)) _ (&a-module/set-imports imports) _ (&/map% (partial process-def-entry load-def-value module) def-entries) @@ -144,14 +149,17 @@ (contains? cache-table* _module))) imports) (let [tag-groups (parse-tag-groups _tags-section) - [module-anns _] (&&&ann/deserialize _module-anns-section) + [?module-anns _] (if (= "..." _module-anns-section) + [&/$None nil] + (let [[module-anns _] (&&&ann/deserialize _module-anns-section)] + [(&/$Some module-anns) _])) def-entries (let [def-entries (vec (.split ^String _defs-section &&core/entry-separator))] (if (= [""] def-entries) &/$Nil (&/->list def-entries)))] (|do [_ (install-all-defs-in-module module-name) _ (install-module load-def-value module-name module-hash - imports tag-groups module-anns def-entries) + imports tag-groups ?module-anns def-entries) =module (&/find-module module-name)] (return (&/T [true (assoc cache-table* module-name =module)])))) (return (&/T [false cache-table*]))))) diff --git a/luxc/src/lux/compiler/core.clj b/luxc/src/lux/compiler/core.clj index 8367678c3..d3fc0d9af 100644 --- a/luxc/src/lux/compiler/core.clj +++ b/luxc/src/lux/compiler/core.clj @@ -4,7 +4,7 @@ [clojure.java.io :as io] [clojure.core.match :as M :refer [matchv]] clojure.core.match.array - (lux [base :as & :refer [|let |do return* return fail*]]) + (lux [base :as & :refer [|case |let |do return* return fail*]]) (lux.analyser [base :as &a] [module :as &a-module]) (lux.compiler.cache [type :as &&&type] @@ -44,7 +44,7 @@ (defn generate-module-descriptor [file-hash] (|do [module-name &/get-module-name - module-anns (&a-module/get-anns module-name) + ?module-anns (&a-module/get-anns module-name) defs &a-module/defs imports &a-module/imports tag-groups &a-module/tag-groups @@ -75,7 +75,12 @@ (Long/toUnsignedString file-hash) import-entries tag-entries - (&&&ann/serialize module-anns) + (|case ?module-anns + (&/$Some module-anns) + (&&&ann/serialize module-anns) + + (&/$None _) + "...") def-entries) (&/|interpose section-separator) (&/fold str ""))]] |