From 0952b1d1ca71089a092fde7758481ba4de71e151 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 31 Oct 2021 22:04:59 -0400 Subject: Properly inheriting the default profile in Aedifex. --- stdlib/source/test/lux/extension.lux | 67 +++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 17 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index 63f3b0d5d..8a4d58f25 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -25,6 +25,8 @@ [collection ["[0]" sequence] ["[0]" list ("[1]#[0]" functor)]]] + [macro + ["[0]" template]] [math ["[0]" random] [number @@ -36,6 +38,7 @@ [lux ["[0]" analysis] ["[0]" synthesis] + ["[0]" generation] ["[0]" directive] [phase [analysis @@ -44,11 +47,18 @@ [\\library ["[0]" / {"+" analysis: synthesis: generation: directive:}]]) -(def: my_analysis "my analysis") -(def: my_synthesis "my synthesis") -(def: my_generation "my generation") (def: dummy_generation "dummy generation") -(def: my_directive "my directive") + +(template [] + [(def: + Text + (`` (%.symbol (symbol (~~ (template.symbol [.._ ]))))))] + + [analysis] + [synthesis] + [generation] + [directive] + ) ... Generation (for [@.old @@ -62,33 +72,33 @@ (as_is)) ... Analysis - (analysis: (..my_analysis self phase archive [pass_through .any]) + (analysis: (..analysis self phase archive [pass_through .any]) (phase archive pass_through)) ... Synthesis - (analysis: (..my_synthesis self phase archive [parameters (<>.some .any)]) + (analysis: (..synthesis self phase archive [parameters (<>.some .any)]) (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) (# ! each (|>> {analysis.#Extension self}))))) - (synthesis: (..my_synthesis self phase archive [pass_through .any]) + (synthesis: (..synthesis self phase archive [pass_through .any]) (phase archive pass_through)) ... Generation - (analysis: (..my_generation self phase archive [parameters (<>.some .any)]) + (analysis: (..generation self phase archive [parameters (<>.some .any)]) (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) (# ! each (|>> {analysis.#Extension self}))))) - (synthesis: (..my_generation self phase archive [parameters (<>.some .any)]) + (synthesis: (..generation self phase archive [parameters (<>.some .any)]) (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) (# ! each (|>> {synthesis.#Extension self}))))) - (generation: (..my_generation self phase archive [pass_through .any]) + (generation: (..generation self phase archive [pass_through .any]) (for [@.jvm (# phase.monad each (|>> {jvm.#Embedded} sequence.sequence) (phase archive pass_through))] @@ -113,12 +123,35 @@ @.scheme (scheme.string self)]))) ... Directive - (directive: (..my_directive self phase archive [parameters (<>.some .any)]) - (do phase.monad - [.let [_ (debug.log! (format "Successfully installed directive " (%.text self) "!"))]] + (directive: (..directive self phase archive [expression .any]) + (do [! phase.monad] + [analysis_phase directive.analysis + expressionA (directive.lifted_analysis + (type.with_type .Any + (analysis_phase archive expression))) + + synthesis_phase directive.synthesis + expressionS (directive.lifted_synthesis + (synthesis_phase archive expressionA)) + + generation_phase directive.generation + expressionG (directive.lifted_generation + (generation_phase archive expressionS)) + + _ (directive.lifted_generation + (generation.with_new_context archive + (do ! + [[module_id artifact_id] (generation.context archive) + .let [commentary (format "Successfully installed directive " (%.text self) "!")] + _ (generation.save! artifact_id {.#None} + (for [@.js (js.comment commentary + (js.statement (js.string commentary))) + @.ruby (ruby.comment commentary + (ruby.statement (ruby.string commentary)))]))] + (generation.log! commentary))))] (in directive.no_requirements))) - (`` ((~~ (static ..my_directive)))) + (`` ((~~ (static ..directive)) (n.* 2 3))) )) (def: .public test @@ -134,13 +167,13 @@ (n.= expected (`` ((~~ (static )) expected)))))] - [/.analysis: ..my_analysis] - [/.synthesis: ..my_synthesis])) + [/.analysis: ..analysis] + [/.synthesis: ..synthesis])) (_.cover [/.generation:] (for [@.old false] (and (n.= expected - (`` ((~~ (static ..my_generation)) expected))) + (`` ((~~ (static ..generation)) expected))) (text#= ..dummy_generation (`` ((~~ (static ..dummy_generation)))))))) (_.cover [/.directive:] -- cgit v1.2.3