aboutsummaryrefslogtreecommitdiff
path: root/luxc
diff options
context:
space:
mode:
authorEduardo Julian2019-05-22 00:12:24 -0400
committerEduardo Julian2019-05-22 00:12:24 -0400
commit0bc505930accb00f74724f384ee42c9a4dd32beb (patch)
tree7c7358b2090fe4023af854bc4cdd8987deaf382d /luxc
parent7406fbf75e7f81b466c02ed07d65e62c86e3230a (diff)
Removed the useless #lux.type? annotation tag.
Diffstat (limited to 'luxc')
-rw-r--r--luxc/src/lux/analyser/lux.clj5
-rw-r--r--luxc/src/lux/analyser/meta.clj1
-rw-r--r--luxc/src/lux/analyser/module.clj29
-rw-r--r--luxc/src/lux/compiler/cache/type.clj2
-rw-r--r--luxc/src/lux/compiler/jvm/lux.clj9
5 files changed, 6 insertions, 40 deletions
diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj
index 2a4240aa6..91637033e 100644
--- a/luxc/src/lux/analyser/lux.clj
+++ b/luxc/src/lux/analyser/lux.clj
@@ -268,8 +268,8 @@
(defn ^:private analyse-global [analyse exo-type module name]
(|do [[[r-module r-name] [endo-type ?meta ?value]] (&&module/find-def module name)
;; This is a small shortcut to optimize analysis of typing code.
- _ (if (and (clojure.lang.Util/identical &type/Type endo-type)
- (clojure.lang.Util/identical &type/Type exo-type))
+ _ (if (and (&type/type= &type/Type endo-type)
+ (&type/type= &type/Type exo-type))
(return nil)
(&type/check exo-type endo-type))
_cursor &/cursor]
@@ -553,7 +553,6 @@
(&&/analyse-1+ analyse ?value)))
=meta (&&/analyse-1 analyse &type/Code ?meta)
==meta (eval! (optimize =meta))
- _ (&&module/test-type module-name ?name ==meta (&&/expr-type* =value))
_ (compile-def ?name (optimize =value) ==meta)
_ &type/reset-mappings]
(return &/$Nil)))
diff --git a/luxc/src/lux/analyser/meta.clj b/luxc/src/lux/analyser/meta.clj
index d7a68ecb4..ab0de60a4 100644
--- a/luxc/src/lux/analyser/meta.clj
+++ b/luxc/src/lux/analyser/meta.clj
@@ -40,7 +40,6 @@
(do-template [<name> <tag-name>]
(def <name> (&/T [tag-prefix <tag-name>]))
- type?-tag "type?"
alias-tag "alias"
export?-tag "export?"
tags-tag "tags"
diff --git a/luxc/src/lux/analyser/module.clj b/luxc/src/lux/analyser/module.clj
index b749b64e4..5ac6191fa 100644
--- a/luxc/src/lux/analyser/module.clj
+++ b/luxc/src/lux/analyser/module.clj
@@ -147,8 +147,7 @@
(if-let [$module (->> state (&/get$ &/$modules) (&/|get module))]
(if-let [$def (->> $module (&/get$ $defs) (&/|get name))]
(|let [[?type ?meta ?value] $def]
- (|case (&meta/meta-get &meta/type?-tag ?meta)
- (&/$Some _)
+ (if (&type/type= &type/Type ?type)
(return* state (&/T [(|case (&meta/meta-get &meta/export?-tag ?meta)
(&/$Some _)
true
@@ -156,8 +155,6 @@
_
false)
?value]))
-
- _
((&/fail-with-loc (str "[Analyser Error] Not a type: " (&/ident->text (&/T [module name]))
"\nMETA: " (&/show-ast ?meta)))
state)))
@@ -287,17 +284,6 @@
state))
)))
-(defn ensure-type-def
- "(-> DefData (Lux Type))"
- [def-data]
- (|let [[?type ?meta ?value] def-data]
- (|case (&meta/meta-get &meta/type?-tag ?meta)
- (&/$Some _)
- (return ?type)
-
- _
- (&/fail-with-loc (str "[Analyser Error] Not a type definition: " (&/adt->text def-data))))))
-
(defn defined? [module name]
(&/try-all% (&/|list (|do [_ (find-def! module name)]
(return true))
@@ -434,19 +420,6 @@
(&/T [k "" _def-data])
)))))))))
-(do-template [<name> <type> <tag> <desc>]
- (defn <name> [module name meta type]
- (|case (&meta/meta-get <tag> meta)
- (&/$Some [_ (&/$Bit true)])
- (&/try-all% (&/|list (&type/check <type> type)
- (&/fail-with-loc (str "[Analyser Error] Cannot tag as lux;" <desc> "? if it's not a " <desc> ": " (str module &/+name-separator+ name)))))
-
- _
- (return nil)))
-
- test-type &type/Type &meta/type?-tag "type"
- )
-
(defn fetch-imports [meta]
(|case (&meta/meta-get &meta/imports-tag meta)
(&/$Some [_ (&/$Tuple _parts)])
diff --git a/luxc/src/lux/compiler/cache/type.clj b/luxc/src/lux/compiler/cache/type.clj
index bf5e04ec6..7c622d2c4 100644
--- a/luxc/src/lux/compiler/cache/type.clj
+++ b/luxc/src/lux/compiler/cache/type.clj
@@ -20,7 +20,7 @@
(defn serialize-type
"(-> Type Text)"
[type]
- (if (clojure.lang.Util/identical &type/Type type)
+ (if (&type/type= &type/Type type)
"T"
(|case type
(&/$Primitive name params)
diff --git a/luxc/src/lux/compiler/jvm/lux.clj b/luxc/src/lux/compiler/jvm/lux.clj
index 4aebc2bbf..6f3257d37 100644
--- a/luxc/src/lux/compiler/jvm/lux.clj
+++ b/luxc/src/lux/compiler/jvm/lux.clj
@@ -254,12 +254,6 @@
(|do [_ (return nil)
:let [def-class (&&/load-class! class-loader (&host-generics/->class-name current-class))
def-type (&a/expr-type* ?body)
- is-type? (|case (&a-meta/meta-get &a-meta/type?-tag ?meta)
- (&/$Some [_ (&/$Bit true)])
- true
-
- _
- false)
def-meta ?meta]
def-value (try (return (-> def-class (.getField &/value-field) (.get nil)))
(catch Throwable t
@@ -268,7 +262,8 @@
(throwable->text t)))))
_ (&/without-repl-closure
(&a-module/define module-name ?name def-type def-meta def-value))]
- (|case (&/T [is-type? (&a-meta/meta-get &a-meta/tags-tag def-meta)])
+ (|case (&/T [(&type/type= &type/Type def-type)
+ (&a-meta/meta-get &a-meta/tags-tag def-meta)])
[true (&/$Some [_ (&/$Tuple tags*)])]
(|do [:let [was-exported? (|case (&a-meta/meta-get &a-meta/export?-tag def-meta)
(&/$Some _)