diff options
author | Eduardo Julian | 2017-10-17 02:01:41 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-17 02:01:41 -0400 |
commit | 14e381de130f0c8d3e333cf0523c6c98b9aa84b1 (patch) | |
tree | 104e98ded63d6d06c894df646d33d6097cf7be34 /luxc/src | |
parent | 98bfe062d911163a063f7139a840410964f12878 (diff) |
- Added "for" macro to specify platform-dependent code.
- Some refactoring/re-naming.
Diffstat (limited to 'luxc/src')
-rw-r--r-- | luxc/src/lux/base.clj | 36 | ||||
-rw-r--r-- | luxc/src/lux/compiler/cache.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/compiler/core.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/compiler/js.clj | 2 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm.clj | 2 |
5 files changed, 22 insertions, 22 deletions
diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 7207b2cca..1281df4e6 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -138,9 +138,9 @@ ("REPL" 0)) (deftuple - ["compiler-name" - "compiler-version" - "compiler-mode"]) + ["target" + "version" + "mode"]) ;; Hosts (defvariant @@ -220,7 +220,7 @@ (def ^:const module-class-name "_") (def ^:const +name-separator+ ";") -(def ^:const ^String compiler-version "0.6.0") +(def ^:const ^String version "0.6.0") ;; Constructors (def empty-cursor (T ["" -1 -1])) @@ -803,18 +803,18 @@ _ class-name)))) -(defn default-compiler-info [name mode] - (T [;; compiler-name - name - ;; compiler-version - compiler-version - ;; compiler-mode +(defn default-info [target mode] + (T [;; target + target + ;; version + version + ;; mode mode] )) (defn init-state [name mode host-data] (T [;; "lux;info" - (default-compiler-info name mode) + (default-info name mode) ;; "lux;source" $Nil ;; "lux;cursor" @@ -861,21 +861,21 @@ (defn with-eval [body] (fn [state] - (let [old-mode (->> state (get$ $info) (get$ $compiler-mode))] - (|case (body (update$ $info #(set$ $compiler-mode $Eval %) state)) + (let [old-mode (->> state (get$ $info) (get$ $mode))] + (|case (body (update$ $info #(set$ $mode $Eval %) state)) ($Right state* output) - (return* (update$ $info #(set$ $compiler-mode old-mode %) state*) output) + (return* (update$ $info #(set$ $mode old-mode %) state*) output) ($Left msg) (fail* msg))))) (def get-eval (fn [state] - (return* state (->> state (get$ $info) (get$ $compiler-mode) in-eval?)))) + (return* state (->> state (get$ $info) (get$ $mode) in-eval?)))) (def get-mode (fn [state] - (return* state (->> state (get$ $info) (get$ $compiler-mode))))) + (return* state (->> state (get$ $info) (get$ $mode))))) (def get-top-local-env (fn [state] @@ -994,11 +994,11 @@ (|do [_mode get-mode] (fn [state] (let [output (body (if (in-repl? _mode) - (update$ $info #(set$ $compiler-mode $Build %) state) + (update$ $info #(set$ $mode $Build %) state) state))] (|case output ($Right state* datum) - (return* (update$ $info #(set$ $compiler-mode _mode %) state*) datum) + (return* (update$ $info #(set$ $mode _mode %) state*) datum) _ output))))) diff --git a/luxc/src/lux/compiler/cache.clj b/luxc/src/lux/compiler/cache.clj index e017e08e2..4c3b1a436 100644 --- a/luxc/src/lux/compiler/cache.clj +++ b/luxc/src/lux/compiler/cache.clj @@ -193,7 +193,7 @@ _ (uninstall-all-defs-in-module module-name)] (return cache-table))]] (if (and (= module-hash (Long/parseUnsignedLong ^String _hash)) - (= &/compiler-version _compiler)) + (= &/version _compiler)) (|do [[success? cache-table*] (process-module pre-load! source-dirs cache-table module-name module-hash _imports-section _tags-section _module-anns-section _defs-section load-def-value install-all-defs-in-module uninstall-all-defs-in-module) diff --git a/luxc/src/lux/compiler/core.clj b/luxc/src/lux/compiler/core.clj index 3f8532e94..8367678c3 100644 --- a/luxc/src/lux/compiler/core.clj +++ b/luxc/src/lux/compiler/core.clj @@ -71,7 +71,7 @@ (str type datum-separator))))) (&/|interpose entry-separator) (&/fold str "")) - module-descriptor (->> (&/|list &/compiler-version + module-descriptor (->> (&/|list &/version (Long/toUnsignedString file-hash) import-entries tag-entries diff --git a/luxc/src/lux/compiler/js.clj b/luxc/src/lux/compiler/js.clj index 6eff83688..dbf229fe5 100644 --- a/luxc/src/lux/compiler/js.clj +++ b/luxc/src/lux/compiler/js.clj @@ -173,7 +173,7 @@ :let [full-program-file (str @&&core/!output-dir java.io.File/separator "program.js") _ (&&core/write-file full-program-file (.getBytes (.toString total-buffer)))]] (return nil))] - (|case (m-action (&/init-state "Lux/JS" mode (&&/js-host))) + (|case (m-action (&/init-state "JS" mode (&&/js-host))) (&/$Right ?state _) (do (println "Compilation complete!") (&&cache/clean ?state)) diff --git a/luxc/src/lux/compiler/jvm.clj b/luxc/src/lux/compiler/jvm.clj index e54f92d91..ff728ae81 100644 --- a/luxc/src/lux/compiler/jvm.clj +++ b/luxc/src/lux/compiler/jvm.clj @@ -245,7 +245,7 @@ &&jvm-cache/uninstall-all-defs-in-module) _ (compile-module source-dirs "lux")] (compile-module source-dirs program-module))] - (|case (m-action (&/init-state "Lux/JVM" mode (jvm-host))) + (|case (m-action (&/init-state "JVM" mode (jvm-host))) (&/$Right ?state _) (do (println "Compilation complete!") (&&cache/clean ?state)) |