From 609cc6c16e75c13d87183c38245136fa038b0496 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 8 Sep 2021 02:03:18 -0400 Subject: No more module annotations. --- stdlib/source/library/lux.lux | 41 ++++++++-------------- .../library/lux/tool/compiler/language/lux.lux | 4 --- .../language/lux/phase/analysis/module.lux | 24 ------------- stdlib/source/poly/lux/data/format/json.lux | 1 - stdlib/source/test/lux/macro.lux | 2 -- stdlib/source/test/lux/meta.lux | 9 ----- 6 files changed, 14 insertions(+), 67 deletions(-) (limited to 'stdlib') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index c1696ff86..823132f6c 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -549,7 +549,6 @@ ... #module_aliases (List [Text Text]) ... #definitions (List [Text Global]) ... #imports (List Text) -... #module_annotations (Maybe Code) ... #module_state Module_State])) ("lux def type tagged" Module (#Named ["library/lux" "Module"] @@ -565,14 +564,11 @@ (#Product ... "lux.imports" (#Apply Text List) - (#Product - ... "lux.module_annotations" - (#Apply Code Maybe) - ... module_state - Module_State) + ... module_state + Module_State ))))) (record$ #End) - ["module_hash" "module_aliases" "definitions" "imports" "module_annotations" "module_state"] + ["module_hash" "module_aliases" "definitions" "imports" "module_state"] .public) ... (type: .public Type_Context @@ -1673,7 +1669,7 @@ #scopes scopes #type_context types #host host #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] state] - ({(#Some [#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_annotations _ #module_state _]) + ({(#Some [#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_state _]) ({(#Some constant) ({(#Alias real_name) (#Right [state real_name]) @@ -2210,7 +2206,7 @@ ($' Maybe Macro)) (do maybe_monad [$module (plist\value module modules) - gdef (let' [[#module_hash _ #module_aliases _ #definitions bindings #imports _ #module_annotations _ #module_state _] ("lux type check" Module $module)] + gdef (let' [[#module_hash _ #module_aliases _ #definitions bindings #imports _ #module_state _] ("lux type check" Module $module)] (plist\value name bindings))] ({(#Alias [r_module r_name]) (macro'' modules current_module r_module r_name) @@ -3261,7 +3257,7 @@ (-> Name (Meta [Nat (List Name) Bit Type])) (do meta_monad [=module (..module module) - .let [[#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_annotations _ #module_state _] =module]] + .let [[#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_state _] =module]] (case (plist\value (text\composite "#" name) definitions) (#Some (#Slot [exported type group index])) (in_meta [index @@ -3289,7 +3285,7 @@ (#Named [module name] unnamed) (do meta_monad [=module (..module module) - .let [[#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_annotations _ #module_state _] =module]] + .let [[#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_state _] =module]] (case (plist\value name definitions) (#Some (#Type [exported? (#Named _ _type) (#Right slots)])) (case (interface_methods _type) @@ -4002,7 +3998,7 @@ (#Slot _) (list)))) - (let [[#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_annotations _ #module_state _] =module] + (let [[#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_state _] =module] definitions))] (#Right state (list\conjoint to_alias))) @@ -4084,7 +4080,7 @@ #None #None - (#Some [#definitions definitions #module_hash _ #module_aliases _ #imports _ #module_annotations _ #module_state _]) + (#Some [#definitions definitions #module_hash _ #module_aliases _ #imports _ #module_state _]) (case (plist\value v_name definitions) #None #None @@ -4117,7 +4113,7 @@ #None (#Left (text\composite "Unknown definition: " (name\encoded name))) - (#Some [#definitions definitions #module_hash _ #module_aliases _ #imports _ #module_annotations _ #module_state _]) + (#Some [#definitions definitions #module_hash _ #module_aliases _ #imports _ #module_state _]) (case (plist\value v_name definitions) #None (#Left (text\composite "Unknown definition: " (name\encoded name))) @@ -4401,7 +4397,7 @@ (-> Text Text (Meta Bit)) (do meta_monad [module (module module_name) - .let [[#module_hash _ #module_aliases _ #definitions _ #imports imports #module_annotations _ #module_state _] module]] + .let [[#module_hash _ #module_aliases _ #definitions _ #imports imports #module_state _] module]] (in (is_member? imports import_name)))) (def: (referrals module_name options) @@ -4508,16 +4504,9 @@ (~+ localizations) (~+ openings))))) -(macro: .public (module: tokens) +(macro: .public (module: _imports) (do meta_monad - [.let [[_meta _imports] (: [(List [Code Code]) (List Code)] - (case tokens - (^ (list& [_ (#Record _meta)] _imports)) - [_meta _imports] - - _ - [(list) tokens]))] - current_module current_module_name + [current_module current_module_name imports (imports_parser #0 current_module #End _imports) .let [=imports (|> imports (list\each (: (-> Importation Code) @@ -4528,9 +4517,7 @@ (function (_ [module_name m_alias =refer]) (refer_code module_name m_alias =refer))) imports) - =module (` ("lux def module" [(~ location_code) - (#.Record (~ (definition_annotations _meta)))] - (~ =imports)))]] + =module (` ("lux def module" (~ =imports)))]] (in (#Item =module =refers)))) (macro: .public (\ tokens) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux index 16493d1dc..37ccff163 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux @@ -51,8 +51,6 @@ (_.list (_.and _.text global)) ... #imports (_.list _.text) - ... #module_annotations - (_.maybe _.code) ... #module_state _.any))) @@ -87,8 +85,6 @@ (.list (<>.and .text global)) ... #imports (.list .text) - ... #module_annotations - (.maybe .code) ... #module_state (\ <>.monad in #.Cached)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux index 62bf284c3..845d07f17 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux @@ -65,38 +65,14 @@ #.Compiled "Compiled" #.Cached "Cached")])) -(exception: .public (cannot_set_module_annotations_more_than_once {module Text} {old Code} {new Code}) - (exception.report - ["Module" module] - ["Old annotations" (%.code old)] - ["New annotations" (%.code new)])) - (def: .public (empty hash) (-> Nat Module) [#.module_hash hash #.module_aliases (list) #.definitions (list) #.imports (list) - #.module_annotations #.None #.module_state #.Active]) -(def: .public (set_annotations annotations) - (-> Code (Operation Any)) - (///extension.lifted - (do ///.monad - [self_name meta.current_module_name - self meta.current_module] - (case (value@ #.module_annotations self) - #.None - (function (_ state) - (#try.Success [(revised@ #.modules - (plist.has self_name (with@ #.module_annotations (#.Some annotations) self)) - state) - []])) - - (#.Some old) - (/.except' cannot_set_module_annotations_more_than_once [self_name old annotations]))))) - (def: .public (import module) (-> Text (Operation Any)) (///extension.lifted diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux index 75f042b58..e5b9baca5 100644 --- a/stdlib/source/poly/lux/data/format/json.lux +++ b/stdlib/source/poly/lux/data/format/json.lux @@ -1,5 +1,4 @@ (.module: - {#.doc "Codecs for values in the JSON format."} [library [lux "*" ["[0]" debug] diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index f465b34a6..745eeb005 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -79,7 +79,6 @@ (!global /.log_expansion!) (!global /.log_full_expansion!))) #.imports (list) - #.module_annotations #.None #.module_state #.Active]] [current_module [#.module_hash 0 @@ -89,7 +88,6 @@ (!global ..pow/4) (!global ..repeated))) #.imports (list) - #.module_annotations #.None #.module_state #.Active]]) #.scopes (list) #.type_context [#.ex_counter 0 diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index eaa0ff4d6..cea70ce68 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -183,13 +183,11 @@ #.module_aliases (list) #.definitions (list) #.imports (list) - #.module_annotations #.None #.module_state #.Active] expected_module [#.module_hash 0 #.module_aliases (list) #.definitions (list) #.imports (list imported_module_name) - #.module_annotations #.None #.module_state #.Active] expected_modules (list [expected_current_module expected_module] @@ -380,14 +378,12 @@ #.module_aliases (list) #.definitions current_globals #.imports (list) - #.module_annotations #.None #.module_state #.Active]] [expected_macro_module [#.module_hash 0 #.module_aliases (list) #.definitions macro_globals #.imports (list) - #.module_annotations #.None #.module_state #.Active]]) #.scopes (list) #.type_context [#.ex_counter 0 @@ -498,14 +494,12 @@ #.module_aliases (list) #.definitions current_globals #.imports (list) - #.module_annotations #.None #.module_state #.Active]] [expected_macro_module [#.module_hash 0 #.module_aliases (list) #.definitions macro_globals #.imports (list) - #.module_annotations #.None #.module_state #.Active]]) #.scopes (list) #.type_context [#.ex_counter 0 @@ -672,7 +666,6 @@ #.module_aliases (list) #.definitions (list) #.imports (list tag_module) - #.module_annotations #.None #.module_state #.Active]] [tag_module [#.module_hash 0 @@ -689,7 +682,6 @@ (list\each (function (_ [index short]) [(format "#" short) (#.Slot [true type_1 (#.Item tags_1) index])]))))) #.imports (list) - #.module_annotations #.None #.module_state #.Active]]) #.scopes (list) #.type_context [#.ex_counter 0 @@ -799,7 +791,6 @@ #.module_aliases (list) #.definitions globals #.imports (list) - #.module_annotations #.None #.module_state #.Active]]) #.scopes scopes #.type_context [#.ex_counter 0 -- cgit v1.2.3