aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/tool/compiler
diff options
context:
space:
mode:
authorEduardo Julian2022-01-11 03:34:19 -0400
committerEduardo Julian2022-01-11 03:34:19 -0400
commit7d9ba962cbb5c93367df3a0d2cdf3aea3a62c47d (patch)
tree1c0e8c0e9556c4eb44b97bb545aa4bb3e7d8ee0f /stdlib/source/library/lux/tool/compiler
parent0613deddeb934b523dd59ef0a2c6303716883a0c (diff)
Fixed a bug that broke re-compilation of STDLIB tests in Lua.
Diffstat (limited to 'stdlib/source/library/lux/tool/compiler')
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux26
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/document.lux45
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/key.lux14
3 files changed, 52 insertions, 33 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
index 110b76a3d..23123a8c5 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
@@ -17,7 +17,7 @@
["[1][0]" analysis
["[1]/[0]" type]]
["/[1]" // "_"
- ["/" directive {"+" Phase}]
+ ["/" directive {"+" Operation Phase}]
["[1][0]" analysis
["[0]" evaluation]
["[1]/[0]" macro {"+" Expander}]]
@@ -54,6 +54,26 @@
{try.#Failure error}
{try.#Failure error})))
+(def: (requiring phase archive expansion)
+ (All (_ anchor expression directive)
+ (-> (Phase anchor expression directive) Archive (List Code)
+ (Operation anchor expression directive /.Requirements)))
+ (function (_ state)
+ (loop [state state
+ input expansion
+ output /.no_requirements]
+ (case input
+ {.#End}
+ {try.#Success [state output]}
+
+ {.#Item head tail}
+ (case (phase archive head state)
+ {try.#Success [state' head']}
+ (again state' tail (/.merge_requirements head' output))
+
+ {try.#Failure error}
+ {try.#Failure error})))))
+
(with_expansions [<lux_def_module> (as_is [|form_location| {.#Form (list& [|text_location| {.#Text "lux def module"}] annotations)}])]
(def: .public (phase wrapper expander)
(-> //.Wrapper Expander Phase)
@@ -99,9 +119,7 @@
(# ! each (revised@ /.#referrals (list#composite referrals))))
_
- (|> expansion
- (monad.each ! (again archive))
- (# ! each (list#mix /.merge_requirements /.no_requirements)))))
+ (..requiring again archive expansion)))
_
(//.except ..not_a_directive code)))))))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux
index b9b2ec192..1171852cb 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux
@@ -1,24 +1,24 @@
(.using
- [library
- [lux {"-" Module}
- [abstract
- [monad {"+" do}]]
- [control
- ["[0]" try {"+" Try}]
- ["[0]" exception {"+" exception:}]
- ["<>" parser
- [binary {"+" Parser}]]]
- [data
- [collection
- ["[0]" dictionary {"+" Dictionary}]]
- [format
- ["[0]" binary {"+" Writer}]]]
- [type {"+" :sharing}
- abstract]]]
- [//
- ["[0]" signature {"+" Signature}]
- ["[0]" key {"+" Key}]
- [descriptor {"+" Module}]])
+ [library
+ [lux {"-" Module}
+ [abstract
+ [monad {"+" do}]]
+ [control
+ ["[0]" try {"+" Try}]
+ ["[0]" exception {"+" exception:}]
+ ["<>" parser
+ [binary {"+" Parser}]]]
+ [data
+ [collection
+ ["[0]" dictionary {"+" Dictionary}]]
+ [format
+ ["[0]" binary {"+" Writer}]]]
+ [type {"+" :sharing}
+ abstract]]]
+ [//
+ ["[0]" signature {"+" Signature}]
+ ["[0]" key {"+" Key}]
+ [descriptor {"+" Module}]])
(exception: .public (invalid_signature [expected Signature
actual Signature])
@@ -63,8 +63,9 @@
(def: .public (writer content)
(All (_ d) (-> (Writer d) (Writer (Document d))))
- (let [writer (binary.and signature.writer
- content)]
+ (let [writer ($_ binary.and
+ signature.writer
+ content)]
(|>> :representation writer)))
(def: .public parser
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux
index 7c3be5e1b..a124fae6a 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux
@@ -1,16 +1,16 @@
(.using
- [library
- [lux "*"
- [type
- abstract]]]
- [//
- [signature {"+" Signature}]])
+ [library
+ [lux "*"
+ [type
+ abstract]]]
+ [//
+ [signature {"+" Signature}]])
(abstract: .public (Key k)
Signature
(def: .public signature
- (-> (Key Any) Signature)
+ (All (_ ?) (-> (Key ?) Signature))
(|>> :representation))
(def: .public (key signature sample)