diff options
author | Eduardo Julian | 2020-04-16 00:22:24 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-04-16 00:22:24 -0400 |
commit | 1888b5c3288e4e7653a424e7314ea5c8277ab360 (patch) | |
tree | a40768d314bc610f9c17446d86e33eba44d5e6c8 /stdlib/source/lux/tool/compiler/meta/archive | |
parent | 4f1553c6f6bb579f09749d5b9ca955c43a7440a4 (diff) |
Generating definition names in a new way.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/tool/compiler/meta/archive.lux | 22 | ||||
-rw-r--r-- | stdlib/source/lux/tool/compiler/meta/archive/artifact.lux | 10 |
2 files changed, 24 insertions, 8 deletions
diff --git a/stdlib/source/lux/tool/compiler/meta/archive.lux b/stdlib/source/lux/tool/compiler/meta/archive.lux index a7e1ffe16..edab30124 100644 --- a/stdlib/source/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/lux/tool/compiler/meta/archive.lux @@ -5,7 +5,8 @@ ["." monad (#+ do)]] [control ["." try (#+ Try)] - ["ex" exception (#+ exception:)]] + ["." exception (#+ exception:)] + ["." function]] [data ["." name] ["." text] @@ -21,15 +22,19 @@ ["." descriptor (#+ Module Descriptor)] ["." document (#+ Document)]]) -(exception: #export (unknown-document {module Module}) - (ex.report ["Module" module])) +(exception: #export (unknown-document {module Module} + {known-modules (List Module)}) + (exception.report + ["Module" module] + ["Known Modules" (exception.enumerate function.identity known-modules)])) (exception: #export (cannot-replace-document {module Module} {old (Document Any)} {new (Document Any)}) - (ex.report ["Module" module] - ["Old key" (signature.description (document.signature old))] - ["New key" (signature.description (document.signature new))])) + (exception.report + ["Module" module] + ["Old key" (signature.description (document.signature old))] + ["New key" (signature.description (document.signature new))])) (abstract: #export Archive {} @@ -46,7 +51,7 @@ (#.Some [existing-descriptor existing-document]) (if (is? document existing-document) (#try.Success archive) - (ex.throw cannot-replace-document [module existing-document document])) + (exception.throw cannot-replace-document [module existing-document document])) #.None (#try.Success (|> archive @@ -61,7 +66,8 @@ (#try.Success document) #.None - (ex.throw unknown-document [module]))) + (exception.throw ..unknown-document [module + (dictionary.keys (:representation archive))]))) (def: #export (archived? archive module) (-> Archive Module Bit) diff --git a/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux index 534749ace..256c10a22 100644 --- a/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux @@ -3,6 +3,7 @@ [data ["." text] [collection + ["." list] ["." row (#+ Row)] ["." dictionary (#+ Dictionary)]]] [type @@ -46,8 +47,17 @@ (update@ #next inc) (update@ #artifacts (row.add {#id id #name (#.Some name)})) + (update@ #resolver (dictionary.put name id)) :abstraction)])) + (def: #export (definitions registry) + (-> Registry (List Text)) + (|> registry + :representation + (get@ #artifacts) + row.to-list + (list.search-all (get@ #name)))) + (def: #export (remember name registry) (-> Text Registry (Maybe ID)) (|> (:representation registry) |