diff options
author | Eduardo Julian | 2020-04-18 04:10:45 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-04-18 04:10:45 -0400 |
commit | 4955cfe6f248a039e95b404f26abfae04204740f (patch) | |
tree | c86f33b80a6fe944e4aff78641f91bb66103bd91 /stdlib/source/lux/tool/compiler/meta/archive | |
parent | ae72864af3e95e46a042277873d38c3006361c79 (diff) |
Generating module IDs in a similar way to artifact IDs.
Diffstat (limited to 'stdlib/source/lux/tool/compiler/meta/archive')
-rw-r--r-- | stdlib/source/lux/tool/compiler/meta/archive/artifact.lux | 16 | ||||
-rw-r--r-- | stdlib/source/lux/tool/compiler/meta/archive/descriptor.lux | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux index 256c10a22..2d4559275 100644 --- a/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/lux/tool/compiler/meta/archive/artifact.lux @@ -17,34 +17,34 @@ (abstract: #export Registry {} - {#next ID - #artifacts (Row Artifact) + {#artifacts (Row Artifact) #resolver (Dictionary Text ID)} (def: #export empty Registry - (:abstraction {#next 0 - #artifacts row.empty + (:abstraction {#artifacts row.empty #resolver (dictionary.new text.hash)})) + (def: next + (-> Registry ID) + (|>> :representation (get@ #artifacts) row.size)) + (def: #export (resource registry) (-> Registry [ID Registry]) - (let [id (get@ #next (:representation registry))] + (let [id (..next registry)] [id (|> registry :representation - (update@ #next inc) (update@ #artifacts (row.add {#id id #name #.None})) :abstraction)])) (def: #export (definition name registry) (-> Text Registry [ID Registry]) - (let [id (get@ #next (:representation registry))] + (let [id (..next registry)] [id (|> registry :representation - (update@ #next inc) (update@ #artifacts (row.add {#id id #name (#.Some name)})) (update@ #resolver (dictionary.put name id)) diff --git a/stdlib/source/lux/tool/compiler/meta/archive/descriptor.lux b/stdlib/source/lux/tool/compiler/meta/archive/descriptor.lux index 4582ab702..c6e1e7841 100644 --- a/stdlib/source/lux/tool/compiler/meta/archive/descriptor.lux +++ b/stdlib/source/lux/tool/compiler/meta/archive/descriptor.lux @@ -11,9 +11,9 @@ (type: #export Module Text) (type: #export Descriptor - {#hash Nat - #name Module + {#name Module #file Path - #references (Set Module) + #hash Nat #state Module-State + #references (Set Module) #registry Registry}) |