aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/js/imports.jvm.lux
diff options
context:
space:
mode:
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.lux69
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))))