diff options
Diffstat (limited to 'stdlib/source')
9 files changed, 69 insertions, 43 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux index 91c0262ef..ca4b71fa0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux @@ -25,7 +25,10 @@ [arity {"+" Arity}] ["[1][0]" phase ("[1]#[0]" monad)] [reference - [variable {"+" Register Variable}]]]]]]) + [variable {"+" Register Variable}]] + [meta + [archive + ["[0]" dependency]]]]]]]) (def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) @@ -68,7 +71,8 @@ (def: .public (function statement expression archive [environment arity bodyS]) (-> Phase! (Generator (Abstraction Synthesis))) (do [! ///////phase.monad] - [[function_name body!] (/////generation.with_new_context archive + [dependencies (dependency.dependencies archive bodyS) + [function_name body!] (/////generation.with_new_context archive dependencies (do ! [scope (# ! each ..@scope (/////generation.context archive))] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index 1fdba6ac2..1bf29150f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -782,7 +782,7 @@ [_ (/////generation.execute! ..runtime) _ (/////generation.save! ..module_id {.#None} ..runtime)] (in [(|> artifact.empty - artifact.resource + (artifact.resource true artifact.no_dependencies) product.right) (sequence.sequence [..module_id {.#None} diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux index 4be219e6f..d65324f5a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux @@ -1,38 +1,39 @@ (.using - [library - [lux {"-" case let if symbol} - [abstract - ["[0]" monad {"+" do}]] - [data - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor mix)] - ["[0]" set]]] - [math - [number - ["n" nat] - ["i" int]]] - [target - ["_" python {"+" Expression SVar Statement}]]]] - ["[0]" // "_" - ["[1][0]" runtime {"+" Operation Phase Generator Phase! Generator!}] + [library + [lux {"-" case let if symbol} + [abstract + ["[0]" monad {"+" do}]] + [data + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor mix)] + ["[0]" set]]] + [math + [number + ["n" nat] + ["i" int]]] + [target + ["_" python {"+" Expression SVar Statement}]]]] + ["[0]" // "_" + ["[1][0]" runtime {"+" Operation Phase Generator Phase! Generator!}] + ["[1][0]" reference] + ["[1][0]" primitive] + ["/[1]" // "_" ["[1][0]" reference] - ["[1][0]" primitive] ["/[1]" // "_" - ["[1][0]" reference] + [synthesis + ["[0]" case]] ["/[1]" // "_" - [synthesis - ["[0]" case]] - ["/[1]" // "_" - ["[1][0]" synthesis {"+" Member Synthesis Path}] - ["[1][0]" generation] - ["//[1]" /// "_" - [reference - ["[1][0]" variable {"+" Register}]] - ["[1][0]" phase ("[1]#[0]" monad)] - [meta - [archive {"+" Archive}]]]]]]]) + ["[1][0]" synthesis {"+" Member Synthesis Path}] + ["[1][0]" generation] + ["//[1]" /// "_" + [reference + ["[1][0]" variable {"+" Register}]] + ["[1][0]" phase ("[1]#[0]" monad)] + [meta + [archive {"+" Archive} + ["[0]" dependency]]]]]]]]) (def: .public (symbol prefix) (-> Text (Operation SVar)) @@ -323,7 +324,10 @@ (def: .public (case statement expression archive [valueS pathP]) (-> Phase! (Generator [Synthesis Path])) (do ///////phase.monad - [[[case_module case_artifact] pattern_matching!] (/////generation.with_new_context archive + [dependencies (dependency.path_dependencies archive pathP) + [[case_module case_artifact] pattern_matching!] (/////generation.with_new_context + archive + dependencies (case! true statement expression archive [valueS pathP])) .let [@case (_.var (///reference.artifact [case_module case_artifact])) @dependencies+ (..dependencies (/////synthesis.path/seq (/////synthesis.path/then valueS) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux index 773f28270..816353edd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux @@ -29,7 +29,8 @@ [variable {"+" Register Variable}]] [meta [archive {"+" Archive} - ["[0]" artifact]]]]]]]) + ["[0]" artifact] + ["[0]" dependency]]]]]]]) (def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) @@ -69,7 +70,8 @@ (def: .public (function statement expression archive [environment arity bodyS]) (-> Phase! (Generator (Abstraction Synthesis))) (do [! ///////phase.monad] - [[[function_module function_artifact] body!] (/////generation.with_new_context archive + [dependencies (dependency.dependencies archive bodyS) + [[function_module function_artifact] body!] (/////generation.with_new_context archive dependencies (/////generation.with_anchor 1 (statement expression archive bodyS))) environment (monad.each ! (expression archive) environment) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 304e5ef01..163ce3b9d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -28,6 +28,9 @@ ["[1][0]" generation] ["//[1]" /// "_" ["[1][0]" phase] + [meta + [archive + ["[0]" dependency]]] [reference ["[1][0]" variable {"+" Register}]]]]]]]) @@ -74,8 +77,9 @@ ... true loop _ (do [! ///////phase.monad] - [initsO+ (monad.each ! (expression archive) initsS+) - [[loop_module loop_artifact] body!] (/////generation.with_new_context archive + [dependencies (dependency.dependencies archive bodyS) + initsO+ (monad.each ! (expression archive) initsS+) + [[loop_module loop_artifact] body!] (/////generation.with_new_context archive dependencies (/////generation.with_anchor start (statement expression archive bodyS))) .let [@loop (_.var (///reference.artifact [loop_module loop_artifact])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux index 1b89fd694..2f99ad62b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux @@ -453,7 +453,7 @@ [_ (/////generation.execute! ..runtime) _ (/////generation.save! ..module_id {.#None} ..runtime)] (in [(|> artifact.empty - artifact.resource + (artifact.resource true artifact.no_dependencies) product.right) (sequence.sequence [..module_id {.#None} diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux index 1c4bee276..ccad8ba2a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux @@ -28,8 +28,7 @@ [reference [variable {"+" Register Variable}]] [meta - [archive {"+" Archive} - ["[0]" artifact] + [archive ["[0]" dependency]]]]]]]) (def: .public (apply expression archive [functionS argsS+]) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/dependency.lux index 70f5b5744..5961a373f 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/dependency.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/dependency.lux @@ -164,6 +164,17 @@ (monad.each ! (generation.remember archive)) (# ! each (set.of_list context_hash))))) +(def: .public (path_dependencies archive value) + (All (_ anchor expression directive) + (-> Archive Path (Operation anchor expression directive (Set artifact.Dependency)))) + (let [! phase.monad] + (|> value + (..path_references ..references) + (set.of_list symbol.hash) + set.list + (monad.each ! (generation.remember archive)) + (# ! each (set.of_list context_hash))))) + (def: .public all (-> (List (Set artifact.Dependency)) (Set artifact.Dependency)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux index bab2f6ed9..b4b1df413 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -269,4 +269,6 @@ .let [_ (do_to sink (java/io/Flushable::flush) (java/io/Closeable::close))]] - (in (java/io/ByteArrayOutputStream::toByteArray buffer))))) + (in (|> buffer + java/io/ByteArrayOutputStream::toByteArray + {.#Left}))))) |