From 736521eb56a45122eb0a545b677d3ffca1451080 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 28 Oct 2022 23:11:52 -0400 Subject: Eliminated the .alias# extension. Now detecting aliases in .def#. --- stdlib/source/library/lux.lux | 47 ++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 0be0527c4..d8ef5fd2f 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -489,11 +489,11 @@ #0) ... (type .public Definition -... [Bit Type Any]) +... [Type Any]) (.def# Definition (.is# Type {#Named [..prelude "Definition"] - {#Product Bit {#Product Type Any}}}) + {#Product Type Any}}) .public) ... (type .public Default @@ -692,7 +692,7 @@ ... (Record ... [#module_hash Nat ... #module_aliases (List [Text Text]) -... #definitions (List [Text Global]) +... #definitions (List [Text [Bit Global]]) ... #imports (List Text) ... #module_state Module_State])) (.def# Module @@ -706,7 +706,7 @@ {#Apply {#Product Text Text} List} {#Product ... definitions - {#Apply {#Product Text Global} List} + {#Apply {#Product Text {#Product Bit Global}} List} {#Product ... imports {#Apply Text List} @@ -1841,7 +1841,7 @@ ..#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_state _]} - ({{#Some constant} + ({{#Some [_ constant]} ({{#Definition _} {#Right [state full_name]} @@ -1972,11 +1972,11 @@ ({{#None} {#Left (text#composite "Unknown definition: " (symbol#encoded name))} - {#Some definition} + {#Some [exported? definition]} ({{#Alias real_name} (definition_value real_name state) - {#Definition [exported? def_type def_value]} + {#Definition [def_type def_value]} (if (available? expected_module current_module exported?) {#Right [state [def_type def_value]]} {#Left (text#composite "Unavailable definition: " (symbol#encoded name))}) @@ -2637,12 +2637,13 @@ ($ Maybe Macro)) (do maybe#monad [$module (property#value module modules) - gdef (let' [[..#module_hash _ ..#module_aliases _ ..#definitions bindings ..#imports _ ..#module_state _] (.is# Module $module)] - (property#value name bindings))] + exported?,gdef (let' [[..#module_hash _ ..#module_aliases _ ..#definitions bindings ..#imports _ ..#module_state _] (.is# Module $module)] + (property#value name bindings)) + .let' [[exported? gdef] exported?,gdef]] ({{#Alias [r_module r_name]} (named_macro' modules current_module r_module r_name) - {#Definition [exported? def_type def_value]} + {#Definition [def_type def_value]} (if (macro_type? def_type) (if exported? {#Some (.as# Macro def_value)} @@ -3889,7 +3890,7 @@ ..#imports _ ..#module_state _] =module]] (when (property#value name definitions) - {#Some {#Definition [exported type value]}} + {#Some [exported {#Definition [type value]}]} (meta#in [exported (as Label value)]) _ @@ -3905,13 +3906,13 @@ ..#definitions definitions ..#imports _ ..#module_state _] module]] - (in ((is (-> (List [Text Global]) + (in ((is (-> (List [Text [Bit Global]]) (Maybe (List Symbol))) (function (again remaining) (when remaining {#Item [slot head] tail} (when head - {#Definition [exported? type value]} + [exported? {#Definition [type value]}] (if (and (type#= Slot type) (or exported? (text#= expected_module actual_module))) @@ -3954,7 +3955,7 @@ ..#imports _ ..#module_state _] =module]] (when (property#value name definitions) - {#Some {#Definition [exported? type value]}} + {#Some [exported? {#Definition [type value]}]} (if (type#= Type type) (do meta#monad [slots (slot_family module (as Type value))] @@ -4470,14 +4471,16 @@ [current_module modules])] (when (property#value module modules) {#Some =module} - (let [to_alias (list#each (is (-> [Text Global] + (let [to_alias (list#each (is (-> [Text [Bit Global]] (List Text)) - (function (_ [name definition]) + (function (_ [name [exported? definition]]) (when definition {#Alias _} - (list) + (if exported? + (list name) + (list)) - {#Definition [exported? def_type def_value]} + {#Definition [def_type def_value]} (if exported? (list name) (list)) @@ -4537,7 +4540,9 @@ (def (alias_definition imported_module def) (-> Text Text Code) - (` (.alias# (, (local$ def)) (, (symbol$ [imported_module def]))))) + (` (.def# (, (local$ def)) + (, (symbol$ [imported_module def])) + .private))) (def .public only (macro (_ tokens) @@ -4609,12 +4614,12 @@ {#None} {#None} - {#Some definition} + {#Some [exported? definition]} (when definition {#Alias real_name} (definition_type real_name state) - {#Definition [exported? def_type def_value]} + {#Definition [def_type def_value]} {#Some def_type} {#Default _} -- cgit v1.2.3