diff options
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/analyser/module.clj | 3 | ||||
-rw-r--r-- | luxc/src/lux/base.clj | 11 |
2 files changed, 9 insertions, 5 deletions
diff --git a/luxc/src/lux/analyser/module.clj b/luxc/src/lux/analyser/module.clj index 8c5a2d286..c8a263030 100644 --- a/luxc/src/lux/analyser/module.clj +++ b/luxc/src/lux/analyser/module.clj @@ -279,7 +279,8 @@ (fn [state] (return* (->> state (&/update$ &/$modules #(&/|put name (new-module hash) %)) - (&/set$ &/$scopes (&/|list (&/env name &/$Nil)))) + (&/set$ &/$scopes (&/|list (&/env name &/$Nil))) + (&/set$ &/$current-module (&/$Some name))) nil))) (do-template [<name> <tag> <type>] diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 3bf0eaf08..910bdfadf 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -151,6 +151,7 @@ ["info" "source" "cursor" + "current-module" "modules" "scopes" "type-context" @@ -819,6 +820,8 @@ $Nil ;; "lux;cursor" (T ["" -1 -1]) + ;; "current-module" + $None ;; "lux;modules" (|table) ;; "lux;scopes" @@ -910,13 +913,13 @@ (def get-module-name (fn [state] - (|case (|reverse (get$ $scopes state)) - ($Nil) + (|case (get$ $current-module state) + ($None) ((fail-with-loc "[Analyser Error] Cannot get the module-name without a module.") state) - ($Cons ?global _) - (return* state (|head (get$ $name ?global)))))) + ($Some module-name) + (return* state module-name)))) (defn find-module [name] "(-> Text (Lux (Module Compiler)))" |