From 1bbc4251230cee13d46df7b706859e834778aee0 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 10 Jul 2022 18:00:23 -0400 Subject: Removed the need for ,! unquoting. --- lux-bootstrapper/src/lux/analyser.clj | 3 ++- lux-bootstrapper/src/lux/analyser/lux.clj | 18 +++++++++--------- lux-bootstrapper/src/lux/analyser/module.clj | 8 +++++--- lux-bootstrapper/src/lux/analyser/proc/common.clj | 8 -------- lux-bootstrapper/src/lux/compiler/jvm.clj | 2 +- 5 files changed, 17 insertions(+), 22 deletions(-) (limited to 'lux-bootstrapper/src') diff --git a/lux-bootstrapper/src/lux/analyser.clj b/lux-bootstrapper/src/lux/analyser.clj index 286205e44..8d440598b 100644 --- a/lux-bootstrapper/src/lux/analyser.clj +++ b/lux-bootstrapper/src/lux/analyser.clj @@ -84,7 +84,8 @@ (&/$Identifier ?ident) (&/with-analysis-meta location exo-type - (&&lux/analyse-identifier analyse exo-type ?ident)) + (|let [[quoted_module quoted_line quoted_column] location] + (&&lux/analyse-identifier analyse exo-type quoted_module ?ident))) (&/$Form (&/$Item [command-meta command] parameters)) (|case command diff --git a/lux-bootstrapper/src/lux/analyser/lux.clj b/lux-bootstrapper/src/lux/analyser/lux.clj index 07ef7e07f..0ae77b537 100644 --- a/lux-bootstrapper/src/lux/analyser/lux.clj +++ b/lux-bootstrapper/src/lux/analyser/lux.clj @@ -284,8 +284,8 @@ (&/$None) (analyse-tuple analyse (&/$Right exo-type) ?elems)))) -(defn ^:private analyse-global [analyse exo-type module name] - (|do [[[r-module r-name] [exported? endo-type ?value]] (&&module/find-def module name) +(defn ^:private analyse-global [analyse exo-type quoted_module module name] + (|do [[[r-module r-name] [exported? endo-type ?value]] (&&module/find-def quoted_module module name) ;; This is a small shortcut to optimize analysis of typing code. _ (if (and (&type/type= &type/Type endo-type) (&type/type= &type/Type exo-type)) @@ -295,12 +295,12 @@ (return (&/|list (&&/|meta endo-type _location (&&/$def (&/T [r-module r-name]))))))) -(defn ^:private analyse-local [analyse exo-type name] +(defn ^:private analyse-local [analyse exo-type quoted_module name] (|do [local? (&&module/find_local name)] (|case local? (&/$None) (|do [module-name &/get-module-name] - (analyse-global analyse exo-type module-name name)) + (analyse-global analyse exo-type quoted_module module-name name)) (&/$Some [local inner outer]) (|let [scopes (&/|map #(&/get$ &/$name %) inner) @@ -315,11 +315,11 @@ (return (&/|list =local))) (&/set$ &/$scopes (&/|++ inner* outer) state))))))) -(defn analyse-identifier [analyse exo-type ident] +(defn analyse-identifier [analyse exo-type quoted_module ident] (|do [:let [[?module ?name] ident]] (if (= "" ?module) - (analyse-local analyse exo-type ?name) - (analyse-global analyse exo-type ?module ?name)))) + (analyse-local analyse exo-type quoted_module ?name) + (analyse-global analyse exo-type quoted_module ?module ?name)))) (defn ^:private analyse-apply* [analyse exo-type fun-type ?args] (|case ?args @@ -562,7 +562,7 @@ (defn ^:private ensure-undefined! [module-name local-name] (|do [verdict (&&module/defined? module-name local-name)] (if verdict - (|do [[[real-module real-name] _] (&&module/find-def module-name local-name) + (|do [[[real-module real-name] _] (&&module/find-def "" module-name local-name) :let [wanted-name (str module-name &/+name-separator+ local-name) source-name (str real-module &/+name-separator+ real-name)]] (&/assert! false @@ -615,7 +615,7 @@ (|let [[r-module r-name] ?original] (|do [module-name &/get-module-name _ (ensure-undefined! module-name ?alias) - _ (&&module/find-def r-module r-name) + _ (&&module/find-def "" r-module r-name) _ (&/without-repl-closure (&&module/define-alias module-name ?alias ?original))] (return &/$End)))) diff --git a/lux-bootstrapper/src/lux/analyser/module.clj b/lux-bootstrapper/src/lux/analyser/module.clj index 1cf3f6f4f..eebac2d80 100644 --- a/lux-bootstrapper/src/lux/analyser/module.clj +++ b/lux-bootstrapper/src/lux/analyser/module.clj @@ -201,7 +201,7 @@ " at module: " current-module)) state))))) -(defn find-def [module name] +(defn find-def [quoted_module module name] (|do [current-module &/get-module-name] (fn [state] (if-let [$module (->> state (&/get$ &/$modules) (&/|get module))] @@ -218,7 +218,8 @@ (&/$DefinitionG [exported? ?type ?value]) (if (or (.equals ^Object current-module module) (and exported? - (or (.equals ^Object module &/prelude) + (or (.equals ^Object &/prelude module) + (.equals ^Object quoted_module module) (imports? state module current-module)))) (return* state (&/T [(&/T [module name]) (&/T [exported? ?type ?value])])) @@ -229,7 +230,8 @@ (&/$TypeG [exported? ?value labels]) (if (or (.equals ^Object current-module module) (and exported? - (or (.equals ^Object module &/prelude) + (or (.equals ^Object &/prelude module) + (.equals ^Object quoted_module module) (imports? state module current-module)))) (return* state (&/T [(&/T [module name]) (&/T [exported? &type/Type ?value])])) diff --git a/lux-bootstrapper/src/lux/analyser/proc/common.clj b/lux-bootstrapper/src/lux/analyser/proc/common.clj index 6b96be2ce..0bc113110 100644 --- a/lux-bootstrapper/src/lux/analyser/proc/common.clj +++ b/lux-bootstrapper/src/lux/analyser/proc/common.clj @@ -211,13 +211,6 @@ analyse-io-error &type/Text &type/Nothing ["io" "error"] ) -(defn- analyse-io-current-time [analyse exo-type ?values] - (|do [:let [(&/$End) ?values] - _ (&type/check exo-type &type/Int) - _location &/location] - (return (&/|list (&&/|meta exo-type _location - (&&/$proc (&/T ["io" "current-time"]) (&/|list) (&/|list))))))) - (defn- analyse-syntax-char-case! [analyse exo-type ?values] (|do [:let [(&/$Item ?input (&/$Item [_ (&/$Tuple ?pairs)] (&/$Item ?else (&/$End)))) ?values] _location &/location @@ -246,7 +239,6 @@ "lux io log" (analyse-io-log analyse exo-type ?values) "lux io error" (analyse-io-error analyse exo-type ?values) - "lux io current-time" (analyse-io-current-time analyse exo-type ?values) "lux text =" (analyse-text-eq analyse exo-type ?values) "lux text <" (analyse-text-lt analyse exo-type ?values) diff --git a/lux-bootstrapper/src/lux/compiler/jvm.clj b/lux-bootstrapper/src/lux/compiler/jvm.clj index 1baec30e1..fcccfec9e 100644 --- a/lux-bootstrapper/src/lux/compiler/jvm.clj +++ b/lux-bootstrapper/src/lux/compiler/jvm.clj @@ -251,7 +251,7 @@ &&jvm-cache/uninstall-all-defs-in-module) _ (compile-module source-dirs &/prelude nil)] (compile-module source-dirs program-module - (|do [[de_aliased_symbol [exported? actual-type ?value]] (&a-module/find-def program-module program-definition) + (|do [[de_aliased_symbol [exported? actual-type ?value]] (&a-module/find-def "" program-module program-definition) _ (&type/check program-type actual-type) here &/location] (&&lux/compile-program (partial compile-expression nil) -- cgit v1.2.3