diff options
author | Eduardo Julian | 2020-05-16 20:19:34 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-05-16 20:19:34 -0400 |
commit | 9965c551e7ccd6de8c47c7b1b78f804801810dac (patch) | |
tree | 05538c6ede048898f375ce3a333a2c4dd6b6f4a7 /new-luxc/source/luxc/lang/translation/js/imports.jvm.lux | |
parent | 65d0beab4cb53a9ba8574e1133d105420f0b23aa (diff) |
Parallel compilation for the new compiler(s).
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/js/imports.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/imports.jvm.lux | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/imports.jvm.lux b/new-luxc/source/luxc/lang/translation/js/imports.jvm.lux deleted file mode 100644 index 575650457..000000000 --- a/new-luxc/source/luxc/lang/translation/js/imports.jvm.lux +++ /dev/null @@ -1,69 +0,0 @@ -(.module: - lux - (lux (control [monad #+ do] - ["p" parser] - ["ex" exception #+ exception:]) - (data ["e" error #+ Error] - [maybe] - [text "text/" Eq<Text>] - text/format) - [macro] - (macro [code] - ["s" syntax]) - [io #+ Process]) - (luxc [lang] - (lang [".L" module]))) - -(do-template [<name>] - [(exception: #export (<name> {message Text}) - message)] - - [Invalid-Imports] - [Module-Cannot-Import-Itself] - [Circular-Dependency] - ) - -(type: Import - {#module Text - #alias Text}) - -(def: import (s.Syntax Import) (s.tuple (p.seq s.text s.text))) - -(def: #export (translate-imports translate-module annotations) - (-> (-> Text Lux (Process Lux)) - Code - (Meta (Process Lux))) - (do macro.Monad<Meta> - [_ (moduleL.set-annotations annotations) - current-module macro.current-module-name - imports (let [imports (|> (macro.get-tuple-ann (name-of #.imports) annotations) - (maybe.default (list)))] - (case (s.run imports (p.some import)) - (#e.Success imports) - (wrap imports) - - (#e.Error error) - (lang.throw Invalid-Imports (%code (code.tuple imports))))) - _ (monad.map @ (function (_ [dependency alias]) - (do @ - [_ (lang.assert Module-Cannot-Import-Itself current-module - (not (text/= current-module dependency))) - already-seen? (moduleL.exists? dependency) - circular-dependency? (if already-seen? - (moduleL.active? dependency) - (wrap #0)) - _ (lang.assert Circular-Dependency (format "From: " current-module "\n" - " To: " dependency) - (not circular-dependency?)) - _ (moduleL.import dependency) - _ (if (text/= "" alias) - (wrap []) - (moduleL.alias alias dependency))] - (wrap []))) - imports) - compiler macro.get-compiler] - (wrap (monad.fold io.Monad<Process> - (function (_ import) - (translate-module (get@ #module import))) - compiler - imports)))) |