aboutsummaryrefslogtreecommitdiff
path: root/luxc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--luxc/src/lux/analyser/env.clj16
-rw-r--r--luxc/src/lux/analyser/function.clj2
-rw-r--r--luxc/src/lux/analyser/lux.clj6
3 files changed, 16 insertions, 8 deletions
diff --git a/luxc/src/lux/analyser/env.clj b/luxc/src/lux/analyser/env.clj
index 6f6e9f986..a6be49f98 100644
--- a/luxc/src/lux/analyser/env.clj
+++ b/luxc/src/lux/analyser/env.clj
@@ -1,7 +1,7 @@
(ns lux.analyser.env
(:require clojure.core.match
clojure.core.match.array
- (lux [base :as & :refer [|do return return* |case]])
+ (lux [base :as & :refer [|do return return* |case |let]])
[lux.analyser.base :as &&]))
;; [Exports]
@@ -17,7 +17,7 @@
(let [var-analysis (&&/|meta type &/empty-cursor (&&/$var (&/$Local (->> (&/|head stack) (&/get$ &/$locals) (&/get$ &/$counter)))))]
(&/$Cons (&/update$ &/$locals #(->> %
(&/update$ &/$counter inc)
- (&/update$ &/$mappings (fn [m] (&/|put name var-analysis m))))
+ (&/update$ &/$mappings (fn [m] (&/|put name (&/T [type var-analysis]) m))))
(&/|head stack))
(&/|tail stack))))
state))]
@@ -41,7 +41,10 @@
=return (body (&/update$ &/$scopes
(fn [stack]
(&/$Cons (&/update$ &/$locals #(->> %
- (&/update$ &/$mappings (fn [m] (&/|put name var-analysis m))))
+ (&/update$ &/$mappings (fn [m] (&/|put name
+ (&/T [(&&/expr-type* var-analysis)
+ var-analysis])
+ m))))
(&/|head stack))
(&/|tail stack)))
state))]
@@ -66,5 +69,10 @@
state)
(&/$Cons env _)
- (return* state (->> env (&/get$ &/$captured) (&/get$ &/$mappings))))
+ (return* state (->> env
+ (&/get$ &/$captured)
+ (&/get$ &/$mappings)
+ (&/|map (fn [mapping]
+ (|let [[k v] mapping]
+ (&/T [k (&/|second v)])))))))
))
diff --git a/luxc/src/lux/analyser/function.clj b/luxc/src/lux/analyser/function.clj
index 7d199ba30..68f5e89fe 100644
--- a/luxc/src/lux/analyser/function.clj
+++ b/luxc/src/lux/analyser/function.clj
@@ -24,5 +24,5 @@
register])))]
(&/T [register* (&/update$ &/$captured #(->> %
(&/update$ &/$counter inc)
- (&/update$ &/$mappings (fn [mps] (&/|put name register* mps))))
+ (&/update$ &/$mappings (fn [mps] (&/|put name (&/T [register-type register*]) mps))))
frame)])))
diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj
index 6649628c7..95dc9af59 100644
--- a/luxc/src/lux/analyser/lux.clj
+++ b/luxc/src/lux/analyser/lux.clj
@@ -291,8 +291,8 @@
(|let [[register new-inner] register+new-inner
[register* frame*] (&&function/close-over in-scope name register frame)]
(&/T [register* (&/$Cons frame* new-inner)])))
- (&/T [(or (->> bottom-outer (&/get$ &/$locals) (&/get$ &/$mappings) (&/|get name))
- (->> bottom-outer (&/get$ &/$captured) (&/get$ &/$mappings) (&/|get name)))
+ (&/T [(&/|second (or (->> bottom-outer (&/get$ &/$locals) (&/get$ &/$mappings) (&/|get name))
+ (->> bottom-outer (&/get$ &/$captured) (&/get$ &/$mappings) (&/|get name))))
&/$Nil])
(&/|reverse inner) scopes)]
((|do [_ (&type/check exo-type (&&/expr-type* =local))]
@@ -538,7 +538,7 @@
module-name &/get-module-name
? (&&module/defined? module-name ?name)
_ (&/assert! (not ?)
- (&/fail-with-loc (str "[Analyser Error] Cannot re-define " (str module-name ";" ?name))))
+ (str "[Analyser Error] Cannot re-define " (str module-name ";" ?name)))
=value (&/without-repl-closure
(&/with-scope ?name
(&&/analyse-1+ analyse ?value)))