From ba150e8a206ffba1c5313c26fa88c6dcba6a08aa Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 2 Oct 2022 04:01:58 -0400 Subject: New format for extensions [part 3] --- stdlib/source/test/lux/meta/extension.lux | 108 ++++++++++++++---------------- 1 file changed, 51 insertions(+), 57 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/meta/extension.lux b/stdlib/source/test/lux/meta/extension.lux index a7f585379..bef9aabb3 100644 --- a/stdlib/source/test/lux/meta/extension.lux +++ b/stdlib/source/test/lux/meta/extension.lux @@ -64,14 +64,6 @@ [\\library ["[0]" / (.only analysis synthesis generation declaration)]]))) -(with_template [] - [(def - Text - (`` (%.symbol (symbol (,, (template.symbol [.._ ]))))))] - - [my_declaration] - ) - ... Generation (for @.old (these) @@ -150,55 +142,57 @@ (at phase.monad in {analysis.#Extension (symbol ..dummy_generation|synthesis) (list)}))) ... Declaration - (declaration (..my_declaration self phase archive [expression .any]) - (do [! phase.monad] - [analysis_phase declaration.analysis - expressionA (<| declaration.lifted_analysis - (type.expecting .Any) - (analysis_phase archive expression)) - - lux (<| declaration.lifted_analysis - extension.lifted - meta.compiler_state) - - synthesis_phase declaration.synthesis - expressionS (declaration.lifted_synthesis - (synthesis_phase lux archive expressionA)) - - generation_phase declaration.generation - expressionG (declaration.lifted_generation - (generation_phase lux archive expressionS)) - - _ (declaration.lifted_generation - (generation.with_new_context archive unit.none - (do ! - [[module_id artifact_id] (generation.context archive) - .let [commentary (format "Successfully installed declaration " (%.text self) "!")] - _ (generation.save! artifact_id {.#None} - (for @.jvm (let [$class (jvm/runtime.class_name [module_id artifact_id])] - (<| [$class] - (try.else (binary.empty 0)) - (try#each (binaryF.result class.format)) - (class.class version.v6_0 class.public - (name.internal $class) - {.#None} - (name.internal "java.lang.Object") - (list) - (list) - (list) - sequence.empty))) - @.js (js.comment commentary - (js.statement (js.string commentary))) - @.python (python.comment commentary - (python.statement (python.string commentary))) - @.lua (lua.comment commentary - (lua.statement expressionG)) - @.ruby (ruby.comment commentary - (ruby.statement (ruby.string commentary)))))] - (generation.log! commentary))))] - (in declaration.no_requirements))) - - (`` ((,, (static ..my_declaration)) (n.* 2 3))) + (def my_declaration + Declaration + (declaration (_ self phase archive [expression .any]) + (do [! phase.monad] + [analysis_phase declaration.analysis + expressionA (<| declaration.lifted_analysis + (type.expecting .Any) + (analysis_phase archive expression)) + + lux (<| declaration.lifted_analysis + extension.lifted + meta.compiler_state) + + synthesis_phase declaration.synthesis + expressionS (declaration.lifted_synthesis + (synthesis_phase lux archive expressionA)) + + generation_phase declaration.generation + expressionG (declaration.lifted_generation + (generation_phase lux archive expressionS)) + + _ (declaration.lifted_generation + (generation.with_new_context archive unit.none + (do ! + [[module_id artifact_id] (generation.context archive) + .let [commentary (format "Successfully installed declaration " (%.text self) "!")] + _ (generation.save! artifact_id {.#None} + (for @.jvm (let [$class (jvm/runtime.class_name [module_id artifact_id])] + (<| [$class] + (try.else (binary.empty 0)) + (try#each (binaryF.result class.format)) + (class.class version.v6_0 class.public + (name.internal $class) + {.#None} + (name.internal "java.lang.Object") + (list) + (list) + (list) + sequence.empty))) + @.js (js.comment commentary + (js.statement (js.string commentary))) + @.python (python.comment commentary + (python.statement (python.string commentary))) + @.lua (lua.comment commentary + (lua.statement expressionG)) + @.ruby (ruby.comment commentary + (ruby.statement (ruby.string commentary)))))] + (generation.log! commentary))))] + (in declaration.no_requirements)))) + + (..my_declaration (n.* 2 3)) )) (def .public test -- cgit v1.2.3