aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/compiler/default/phase/extension
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux20
-rw-r--r--stdlib/source/lux/compiler/default/phase/extension/statement.lux29
2 files changed, 27 insertions, 22 deletions
diff --git a/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux b/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux
index 0d1148fbd..59a99800b 100644
--- a/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux
+++ b/stdlib/source/lux/compiler/default/phase/extension/analysis/common.lux
@@ -7,9 +7,10 @@
format]
[collection
["." list ("list/." Functor<List>)]
- ["dict" dictionary (#+ Dictionary)]]]
+ ["." dictionary (#+ Dictionary)]]]
[type
["." check]]
+ ["." macro]
[io (#+ IO)]]
["." ///
["." bundle]
@@ -99,8 +100,9 @@
(case args
(^ (list typeC valueC))
(do ////.Monad<Operation>
- [actualT (:: @ map (|>> (:coerce Type))
- (eval Type typeC))
+ [count (///.lift macro.count)
+ actualT (:: @ map (|>> (:coerce Type))
+ (eval count Type typeC))
_ (typeA.infer actualT)]
(typeA.with-type <type>
(analyse valueC)))
@@ -207,10 +209,10 @@
(-> Eval Bundle)
(<| (bundle.prefix "lux")
(|> bundle.empty
- (dict.merge (bundle::lux eval))
- (dict.merge bundle::bit)
- (dict.merge bundle::int)
- (dict.merge bundle::frac)
- (dict.merge bundle::text)
- (dict.merge bundle::io)
+ (dictionary.merge (bundle::lux eval))
+ (dictionary.merge bundle::bit)
+ (dictionary.merge bundle::int)
+ (dictionary.merge bundle::frac)
+ (dictionary.merge bundle::text)
+ (dictionary.merge bundle::io)
)))
diff --git a/stdlib/source/lux/compiler/default/phase/extension/statement.lux b/stdlib/source/lux/compiler/default/phase/extension/statement.lux
index 7daf27227..afc7c843c 100644
--- a/stdlib/source/lux/compiler/default/phase/extension/statement.lux
+++ b/stdlib/source/lux/compiler/default/phase/extension/statement.lux
@@ -26,7 +26,7 @@
(All [anchor expression statement]
(-> Type Code (Operation anchor expression statement [Type expression Any])))
(do ///.Monad<Operation>
- [state (extension.lift ///.state)
+ [state (extension.lift ///.get-state)
#let [analyse (get@ [#statement.analysis #statement.phase] state)
synthesize (get@ [#statement.synthesis #statement.phase] state)
translate (get@ [#statement.translation #statement.phase] state)]
@@ -40,17 +40,19 @@
codeS (statement.lift-synthesis
(synthesize codeA))]
(statement.lift-translation
- (do @
- [codeT (translate codeS)
- codeV (translation.evaluate! codeT)]
- (wrap [code//type codeT codeV])))))
+ (translation.with-buffer
+ (do @
+ [codeT (translate codeS)
+ count translation.next
+ codeV (translation.evaluate! (format "evaluate" (%n count)) codeT)]
+ (wrap [code//type codeT codeV]))))))
(def: (define! name ?type codeC)
(All [anchor expression statement]
(-> Name (Maybe Type) Code
(Operation anchor expression statement [Type expression Text Any])))
(do ///.Monad<Operation>
- [state (extension.lift ///.state)
+ [state (extension.lift ///.get-state)
#let [analyse (get@ [#statement.analysis #statement.phase] state)
synthesize (get@ [#statement.synthesis #statement.phase] state)
translate (get@ [#statement.translation #statement.phase] state)]
@@ -73,10 +75,11 @@
codeS (statement.lift-synthesis
(synthesize codeA))]
(statement.lift-translation
- (do @
- [codeT (translate codeS)
- codeN+V (translation.define! name codeT)]
- (wrap [code//type codeT codeN+V])))))
+ (translation.with-buffer
+ (do @
+ [codeT (translate codeS)
+ codeN+V (translation.define! name codeT)]
+ (wrap [code//type codeT codeN+V]))))))
(def: lux::def
Handler
@@ -97,8 +100,7 @@
valueC)
_ (statement.lift-analysis
(do @
- [_ (module.define def-name [value//type annotationsV valueV])
- #let [_ (log! (format "Definition " (%name full-name)))]]
+ [_ (module.define def-name [value//type annotationsV valueV])]
(if (macro.type? annotationsV)
(case (macro.declared-tags annotationsV)
#.Nil
@@ -106,7 +108,8 @@
tags
(module.declare-tags tags (macro.export? annotationsV) (:coerce Type valueV)))
- (wrap []))))]
+ (wrap []))))
+ #let [_ (log! (format "Definition " (%name full-name)))]]
(statement.lift-translation
(translation.learn full-name valueN)))