diff options
Diffstat (limited to 'stdlib/source/library')
-rw-r--r-- | stdlib/source/library/lux/meta/compiler/default/platform.lux | 66 | ||||
-rw-r--r-- | stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/function/field/constant/arity.lux | 20 |
2 files changed, 58 insertions, 28 deletions
diff --git a/stdlib/source/library/lux/meta/compiler/default/platform.lux b/stdlib/source/library/lux/meta/compiler/default/platform.lux index 61115fb32..488e04e79 100644 --- a/stdlib/source/library/lux/meta/compiler/default/platform.lux +++ b/stdlib/source/library/lux/meta/compiler/default/platform.lux @@ -115,7 +115,8 @@ (-> context.Context <Platform> module.ID (Key document) (Format document) (archive.Entry document) (Async (Try Any)))) (let [system (the #file_system platform) - write_artifact! (is (-> [artifact.ID (Maybe Text) Binary] (Action Any)) + write_artifact! (is (-> [artifact.ID (Maybe Text) Binary] + (Action Any)) (function (_ [artifact_id custom content]) (is (Async (Try Any)) (cache/artifact.cache! system context @module artifact_id content))))] @@ -152,7 +153,8 @@ ... TODO: Inline ASAP (def (compile_runtime! platform) (All (_ <type_vars>) - (-> <Platform> (///translation.Operation <type_vars> [Registry Output]))) + (-> <Platform> + (///translation.Operation <type_vars> [Registry Output]))) (do phase.monad [_ ..initialize_buffer!] (the #runtime platform))) @@ -201,7 +203,8 @@ (//init.with_defaults .prelude all_extensions))) (def (with_extended_prelude state archive) - (-> Lux Archive Archive) + (-> Lux Archive + Archive) (|> (do try.monad [prelude (meta.result state (meta.module .prelude)) entry (archive.find .prelude archive) @@ -238,13 +241,14 @@ [archive analysis_state] (ioW.thaw (list) compilation_configuration (the #host platform) (the #file_system platform) context import compilation_sources) .let [with_missing_extensions (is (All (_ <type_vars>) - (-> (//init.Extensions <type_vars>) <State> (Async (Try <State>)))) + (-> (//init.Extensions <type_vars>) <State> + (Async (Try <State>)))) (function (_ all_extensions state) (|> (initialize_state analysis_state all_extensions) (phase.result' state) (try#each product.left) async#in)))]] - (if (archive.archived? archive .prelude) + (if (archive.archived? archive descriptor.runtime) (do ! [state (with_missing_extensions all_extensions state) .let [archive (with_extended_prelude (the [///declaration.#analysis ///declaration.#state] state) archive)]] @@ -261,7 +265,8 @@ (def (module_compilation_log module) (All (_ <type_vars>) - (-> descriptor.Module <State> Text)) + (-> descriptor.Module <State> + Text)) (|>> (the [///declaration.#translation ///declaration.#state ///translation.#log]) @@ -271,7 +276,8 @@ (def with_reset_log (All (_ <type_vars>) - (-> <State> <State>)) + (-> <State> + <State>)) (has [///declaration.#translation ///declaration.#state ///translation.#log] @@ -296,8 +302,10 @@ #depended_by empty])) (def (depend module import dependence) - (-> descriptor.Module descriptor.Module Dependence Dependence) - (let [transitive_dependency (is (-> (-> Dependence Mapping) descriptor.Module (Set descriptor.Module)) + (-> descriptor.Module descriptor.Module Dependence + Dependence) + (let [transitive_dependency (is (-> (-> Dependence Mapping) descriptor.Module + (Set descriptor.Module)) (function (_ lens module) (|> dependence lens @@ -328,8 +336,10 @@ [import transitive_depended_by]))))) (def (circular_dependency? module import dependence) - (-> descriptor.Module descriptor.Module Dependence Bit) - (let [dependence? (is (-> descriptor.Module (-> Dependence Mapping) descriptor.Module Bit) + (-> descriptor.Module descriptor.Module Dependence + Bit) + (let [dependence? (is (-> descriptor.Module (-> Dependence Mapping) descriptor.Module + Bit) (function (_ from relationship to) (let [targets (|> dependence relationship @@ -357,7 +367,8 @@ ["Duplicates" (%.list %.text (set.list duplicates))]))) (def (verify_dependencies importer importee dependence) - (-> descriptor.Module descriptor.Module Dependence (Try Any)) + (-> descriptor.Module descriptor.Module Dependence + (Try Any)) (cond (text#= importer importee) (exception.except ..module_cannot_import_itself [importer]) @@ -384,10 +395,12 @@ (Signal state)]) (type (Importer state) - (-> (List ///.Custom) descriptor.Module descriptor.Module (Return state))) + (-> (List ///.Custom) descriptor.Module descriptor.Module + (Return state))) (type (Compiler state) - (-> (List ///.Custom) descriptor.Module (Importer state) module.ID (Context state) descriptor.Module (Return state))) + (-> (List ///.Custom) descriptor.Module (Importer state) module.ID (Context state) descriptor.Module + (Return state))) (with_expansions [Lux_Context (..Context <State>) Lux_Return (..Return <State>) @@ -398,7 +411,8 @@ (def (parallel initial) (All (_ <type_vars>) (-> Lux_Context - (-> Lux_Compiler Lux_Importer))) + (-> Lux_Compiler + Lux_Importer))) (let [current (stm.var initial) pending (sharing [<type_vars>] (is Lux_Context @@ -489,7 +503,8 @@ ... TODO: Find a better way, as this only works for the Lux compiler. (def (updated_state archive extended_states state) (All (_ <type_vars>) - (-> Archive (List <State>) <State> (Try <State>))) + (-> Archive (List <State>) <State> + (Try <State>))) (do [! try.monad] [modules (monad.each ! (function (_ module) (do ! @@ -503,10 +518,13 @@ (list#each product.left) (set.of_list text.hash)) with_modules (is (All (_ <type_vars>) - (-> <State> <State>)) + (-> <State> + <State>)) (revised [///declaration.#analysis ///declaration.#state] - (is (All (_ a) (-> a a)) + (is (All (_ a) + (-> a + a)) (function (_ analysis_state) (|> analysis_state (as .Lux) @@ -521,7 +539,8 @@ (def (set_current_module module state) (All (_ <type_vars>) - (-> descriptor.Module <State> <State>)) + (-> descriptor.Module <State> + <State>)) (|> (///declaration.set_current_module module) (phase.result' state) try.trusted @@ -531,7 +550,8 @@ ... This currently assumes that all imports will be specified once in a single .require form. ... This might not be the case in the future. (def (with_new_dependencies new_dependencies all_dependencies) - (-> (List descriptor.Module) (Set descriptor.Module) [(Set descriptor.Module) (Set descriptor.Module)]) + (-> (List descriptor.Module) (Set descriptor.Module) + [(Set descriptor.Module) (Set descriptor.Module)]) (let [[all_dependencies duplicates _] (is [(Set descriptor.Module) (Set descriptor.Module) Bit] (list#mix (function (_ new [all duplicates seen_prelude?]) (if (set.member? all new) @@ -620,7 +640,8 @@ state document) (-> Import context.Context <Platform> (List _io.Context) Configuration (///.Compiler <State> .Module) (Key document) (Format document) (///.Compilation state document) - (-> (List ///.Custom) descriptor.Module Lux_Importer module.ID (..Context state) descriptor.Module (..Return state)))) + (-> (List ///.Custom) descriptor.Module Lux_Importer module.ID (..Context state) descriptor.Module + (..Return state)))) (function (_ customs importer import! @module [archive state] module) (loop (again [[archive state] [archive state] compilation custom_compilation @@ -776,7 +797,8 @@ (def (custom import! it) (All (_ <type_vars>) - (-> Lux_Importer compiler.Compiler (Async (Try [Lux_Context (List Text) Any])))) + (-> Lux_Importer compiler.Compiler + (Async (Try [Lux_Context (List Text) Any])))) (let [/#definition (the compiler.#definition it) [/#module /#name] /#definition] (do ..monad diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/function/field/constant/arity.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/function/field/constant/arity.lux index c798ee0c3..d379a48b3 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/function/field/constant/arity.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/function/field/constant/arity.lux @@ -4,18 +4,26 @@ (.require [library [lux (.except type) + [math + [number + ["[0]" i64]]] [meta [compiler [target [jvm - ["[0]" type] - [constant - [pool (.only Resource)]]]]]]]] + ["[0]" type]]]]]]] ["[0]" // [///////// [arity (.only Arity)]]]) -(def .public minimum Arity 1) -(def .public maximum Arity 8) +(with_template [<power> <name>] + [(def .public <name> + Arity + (i64.left_shifted <power> 1))] -(def .public type type.int) + [0 minimum] + [3 maximum] + ) + +(def .public type + type.int) |