aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/tool/compiler/default/platform.lux35
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/reference.lux1
-rw-r--r--stdlib/source/lux/tool/compiler/program.lux13
3 files changed, 40 insertions, 9 deletions
diff --git a/stdlib/source/lux/tool/compiler/default/platform.lux b/stdlib/source/lux/tool/compiler/default/platform.lux
index 73ee068bb..ced79a306 100644
--- a/stdlib/source/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/lux/tool/compiler/default/platform.lux
@@ -15,10 +15,15 @@
["." init]
["." syntax]
["/." //
+ ["." analysis]
["." statement]
["." phase
[macro (#+ Expander)]
- ["." translation]]
+ ## TODO: Get rid of this import ASAP
+ [extension (#+)]
+ ["." translation]
+ [analysis
+ ["." module]]]
["." cli (#+ Configuration)]
[meta
["." archive (#+ Archive)
@@ -96,7 +101,11 @@
((init.compiler expander syntax.prelude) init.key (list))})]
(loop [module (get@ #cli.module configuration)
[archive state] [archive state]]
- (let [import! (:share [! anchor expression statement]
+ (let [## [state _] (|> (analysis.set-current-module module)
+ ## statement.lift-analysis
+ ## (phase.run' state)
+ ## error.assume)
+ import! (:share [! anchor expression statement]
{<Platform>
platform}
{(-> Module [Archive <State+>]
@@ -114,7 +123,27 @@
compilation (compiler (:coerce ///.Input input))]
(do @
[archive+state' (monad.fold @
- import!
+ (function (_ dependency archive+state')
+ (do @
+ [archive+state'' (import! dependency archive+state')
+ #let [[archive'' state''] (:share [! anchor expression statement]
+ {<Platform>
+ platform}
+ {[Archive <State+>]
+ archive+state''})]]
+ (case (:share [! anchor expression statement]
+ {<State+>
+ state}
+ {(Error [<State+> Any])
+ ## TODO: Get rid of the 'let' below ASAP
+ (let [lifted (statement.lift-analysis
+ (module.import dependency))]
+ (phase.run' state'' lifted))})
+ (#error.Success [state''' _])
+ (wrap [archive'' state'''])
+
+ (#error.Failure error)
+ (:: monad wrap (#error.Failure error)))))
[archive state]
(list.filter (bit.complement (archive.archived? archive))
(get@ #///.dependencies compilation)))
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux b/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux
index ee3767797..507441427 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux
@@ -23,7 +23,6 @@
(exception: #export (definition-has-not-been-expored {definition Name})
(ex.report ["Definition" (%name definition)]))
-## [Analysers]
(def: (definition def-name)
(-> Name (Operation Analysis))
(with-expansions [<return> (wrap (|> def-name reference.constant #/.Reference))]
diff --git a/stdlib/source/lux/tool/compiler/program.lux b/stdlib/source/lux/tool/compiler/program.lux
index 265277ac7..9de17b5df 100644
--- a/stdlib/source/lux/tool/compiler/program.lux
+++ b/stdlib/source/lux/tool/compiler/program.lux
@@ -21,7 +21,9 @@
["." translation]]
[default
["." platform (#+ Platform)]
- ["." syntax]]]
+ ["." syntax]]
+ [meta
+ ["." archive (#+ Archive)]]]
## ["." interpreter]
]]
[//
@@ -77,10 +79,11 @@
platform}
{(IO (Error (statement.State+ anchor expression statement)))
(platform.initialize expander platform bundle)})
- _ (: (IO (Error Any))
- (platform.compile expander platform (set@ #cli.module syntax.prelude configuration) state))
- ## _ (: (IO (Error Any))
- ## (platform.compile expander platform configuration state))
+ _ (:share [anchor expression statement]
+ {(Platform IO anchor expression statement)
+ platform}
+ {(IO (Error [Archive (statement.State+ anchor expression statement)]))
+ (platform.compile expander platform configuration archive.empty state)})
## _ (cache/io.clean target ...)
]
(wrap (log! "Compilation complete!")))))