aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lux/analyser/base.clj2
-rw-r--r--src/lux/analyser/lux.clj16
-rw-r--r--src/lux/compiler.clj2
-rw-r--r--src/lux/compiler/lux.clj6
-rw-r--r--src/lux/optimizer.clj17
5 files changed, 15 insertions, 28 deletions
diff --git a/src/lux/analyser/base.clj b/src/lux/analyser/base.clj
index ba7909453..205e6bd91 100644
--- a/src/lux/analyser/base.clj
+++ b/src/lux/analyser/base.clj
@@ -23,7 +23,7 @@
("apply" 2)
("case" 2)
("lambda" 3)
- ("ann" 3) ;; TODO: Eliminate
+ ("ann" 2)
("var" 1)
("captured" 1)
("proc" 3)
diff --git a/src/lux/analyser/lux.clj b/src/lux/analyser/lux.clj
index 8ecb2c247..a05e96bca 100644
--- a/src/lux/analyser/lux.clj
+++ b/src/lux/analyser/lux.clj
@@ -608,20 +608,10 @@
_ (&type/check exo-type ==type)
=value (&/with-expected-type ==type
(&&/analyse-1 analyse ==type ?value))
- _cursor &/cursor
- ;; =value (&&/analyse-1 analyse ==type ?value)
- ;; :let [_ (prn 0 (&/adt->text =value))
- ;; _ (prn 1 (&/adt->text (coerce ==type =value)))
- ;; _ (prn 2 (&/adt->text (&&/|meta ==type _cursor
- ;; (&&/$ann =value =type ==type)
- ;; )))]
- ]
- ;; (return (&/|list (coerce ==type =value)))
- ;; (analyse ==type ?value)
+ _cursor &/cursor]
(return (&/|list (&&/|meta ==type _cursor
- (&&/$ann =value =type ==type)
- )))
- ))
+ (&&/$ann =value =type)
+ )))))
(defn analyse-coerce [analyse eval! exo-type ?type ?value]
(|do [=type (&&/analyse-1 analyse &type/Type ?type)
diff --git a/src/lux/compiler.clj b/src/lux/compiler.clj
index 7f8c2d0ef..3ff4a053d 100644
--- a/src/lux/compiler.clj
+++ b/src/lux/compiler.clj
@@ -107,7 +107,7 @@
(&&lambda/compile-function compile-expression &/$None ?arity ?scope ?env ?body)
;; TODO: Must get rid of this one...
- (&o/$ann ?value-ex ?type-ex ?value-type)
+ (&o/$ann ?value-ex ?type-ex)
(compile-expression $begin ?value-ex)
(&o/$proc [?proc-category ?proc-name] ?args special-args)
diff --git a/src/lux/compiler/lux.clj b/src/lux/compiler/lux.clj
index 7bb97260e..38176d3ec 100644
--- a/src/lux/compiler/lux.clj
+++ b/src/lux/compiler/lux.clj
@@ -222,8 +222,8 @@
(defn ^:private compile-def-type [compile ?body]
(|do [:let [?def-type (|case ?body
- [[?def-type ?def-cursor] (&o/$ann ?def-value ?type-expr ?def-value-type)]
- ?type-expr
+ [[?def-type ?def-cursor] (&o/$ann ?def-value ?type-expr)]
+ (&o/optimize ?type-expr)
[[?def-type ?def-cursor] ?def-value]
(if (&type/type= &type/Type ?def-type)
@@ -238,7 +238,7 @@
(defn ^:private de-ann [optim]
(|case optim
- [_ (&o/$ann value-expr _ _)]
+ [_ (&o/$ann value-expr _)]
value-expr
_
diff --git a/src/lux/optimizer.clj b/src/lux/optimizer.clj
index fffe1ddbf..03aa5c06d 100644
--- a/src/lux/optimizer.clj
+++ b/src/lux/optimizer.clj
@@ -22,7 +22,7 @@
("apply" 2)
("case" 2)
("function" 4)
- ("ann" 3) ;; TODO: Eliminate
+ ("ann" 2)
("var" 1)
("captured" 3)
("proc" 3)
@@ -379,11 +379,9 @@
captured)
(shift-function-body old-scope new-scope false body*))]))
- ;; TODO: Must get rid of this one...
- ($ann value-expr type-expr type-type)
+ ($ann value-expr type-expr)
(&/T [meta ($ann (shift-function-body old-scope new-scope own-body? value-expr)
- type-expr
- type-type)])
+ type-expr)])
($var var-kind)
(if own-body?
@@ -516,8 +514,8 @@
($function _arity _scope _captured _body)
(&/T [meta ($function _arity _scope _captured (optimize-loop _arity _body))])
- ($ann _value-expr _type-expr _type-type)
- (&/T [meta ($ann (optimize-loop arity _value-expr) _type-expr _type-type)])
+ ($ann _value-expr _type-expr)
+ (&/T [meta ($ann (optimize-loop arity _value-expr) _type-expr)])
_
optim
@@ -616,9 +614,8 @@
=body
(&/T [meta ($function 1 scope (optimize-closure pass-0 captured) =body)]))
- ;; TODO: Must get rid of this one...
- (&a/$ann value-expr type-expr type-type)
- (&/T [meta ($ann (pass-0 value-expr) type-expr type-type)])
+ (&a/$ann value-expr type-expr)
+ (&/T [meta ($ann (pass-0 value-expr) type-expr)])
(&a/$var var-kind)
(&/T [meta ($var var-kind)])