aboutsummaryrefslogtreecommitdiff
path: root/luxc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--luxc/src/lux/analyser.clj4
-rw-r--r--luxc/src/lux/analyser/lux.clj4
-rw-r--r--luxc/src/lux/analyser/meta.clj1
-rw-r--r--luxc/src/lux/analyser/module.clj8
-rw-r--r--luxc/src/lux/compiler/jvm/lux.clj12
-rw-r--r--luxc/src/lux/type.clj16
6 files changed, 15 insertions, 30 deletions
diff --git a/luxc/src/lux/analyser.clj b/luxc/src/lux/analyser.clj
index a6dbeccf2..4d4a2c1a0 100644
--- a/luxc/src/lux/analyser.clj
+++ b/luxc/src/lux/analyser.clj
@@ -150,9 +150,9 @@
(&&lux/analyse-program analyse optimize compile-program ?program)))
"lux def module"
- (|let [(&/$Cons ?meta (&/$Nil)) parameters]
+ (|let [(&/$Cons ?meta (&/$Cons ?imports (&/$Nil))) parameters]
(&/with-cursor cursor
- (&&lux/analyse-module analyse optimize eval! compile-module ?meta)))
+ (&&lux/analyse-module analyse optimize eval! compile-module ?meta ?imports)))
"lux in-module"
(|let [(&/$Cons [_ (&/$Text ?module)] (&/$Cons ?expr (&/$Nil))) parameters]
diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj
index 91637033e..149bd4a99 100644
--- a/luxc/src/lux/analyser/lux.clj
+++ b/luxc/src/lux/analyser/lux.clj
@@ -640,13 +640,13 @@
(return (doto (promise)
(deliver (&/$Right _compiler))))))))
-(defn analyse-module [analyse optimize eval! compile-module ?meta]
+(defn analyse-module [analyse optimize eval! compile-module ?meta ?imports]
(|do [_ &/ensure-statement
=anns (&&/analyse-1 analyse &type/Code ?meta)
==anns (eval! (optimize =anns))
module-name &/get-module-name
_ (&&module/set-anns ==anns module-name)
- _imports (&&module/fetch-imports ==anns)
+ _imports (&&module/fetch-imports ?imports)
current-module &/get-module-name
=asyncs (&/map% (fn [_import]
(|let [[path alias] _import]
diff --git a/luxc/src/lux/analyser/meta.clj b/luxc/src/lux/analyser/meta.clj
index ab0de60a4..07ec470f3 100644
--- a/luxc/src/lux/analyser/meta.clj
+++ b/luxc/src/lux/analyser/meta.clj
@@ -43,5 +43,4 @@
alias-tag "alias"
export?-tag "export?"
tags-tag "tags"
- imports-tag "imports"
)
diff --git a/luxc/src/lux/analyser/module.clj b/luxc/src/lux/analyser/module.clj
index 5ac6191fa..8bc7a64a1 100644
--- a/luxc/src/lux/analyser/module.clj
+++ b/luxc/src/lux/analyser/module.clj
@@ -420,9 +420,9 @@
(&/T [k "" _def-data])
)))))))))
-(defn fetch-imports [meta]
- (|case (&meta/meta-get &meta/imports-tag meta)
- (&/$Some [_ (&/$Tuple _parts)])
+(defn fetch-imports [imports]
+ (|case imports
+ [_ (&/$Tuple _parts)]
(&/map% (fn [_part]
(|case _part
[_ (&/$Tuple (&/$Cons [[_ (&/$Text _module)]
@@ -435,7 +435,7 @@
_parts)
_
- (&/fail-with-loc "[Analyser Error] No import meta-data.")))
+ (&/fail-with-loc "[Analyser Error] Incorrect import syntax.")))
(def ^{:doc "(Lux (List [Text (List Text)]))"}
tag-groups
diff --git a/luxc/src/lux/compiler/jvm/lux.clj b/luxc/src/lux/compiler/jvm/lux.clj
index 6f3257d37..0fec62e8e 100644
--- a/luxc/src/lux/compiler/jvm/lux.clj
+++ b/luxc/src/lux/compiler/jvm/lux.clj
@@ -253,19 +253,18 @@
(defn ^:private install-def! [class-loader current-class module-name ?name ?body ?meta]
(|do [_ (return nil)
:let [def-class (&&/load-class! class-loader (&host-generics/->class-name current-class))
- def-type (&a/expr-type* ?body)
- def-meta ?meta]
+ def-type (&a/expr-type* ?body)]
def-value (try (return (-> def-class (.getField &/value-field) (.get nil)))
(catch Throwable t
(&/assert! false
(str "Error during value initialization:\n"
(throwable->text t)))))
_ (&/without-repl-closure
- (&a-module/define module-name ?name def-type def-meta def-value))]
+ (&a-module/define module-name ?name def-type ?meta def-value))]
(|case (&/T [(&type/type= &type/Type def-type)
- (&a-meta/meta-get &a-meta/tags-tag def-meta)])
+ (&a-meta/meta-get &a-meta/tags-tag ?meta)])
[true (&/$Some [_ (&/$Tuple tags*)])]
- (|do [:let [was-exported? (|case (&a-meta/meta-get &a-meta/export?-tag def-meta)
+ (|do [:let [was-exported? (|case (&a-meta/meta-get &a-meta/export?-tag ?meta)
(&/$Some _)
true
@@ -303,11 +302,10 @@
(if (= 1 (&/|length ?meta*))
(|do [:let [current-class (&host-generics/->class-name (str (&host/->module-class r-module) "/" (&host/def-name r-name)))
def-class (&&/load-class! class-loader current-class)
- def-meta ?meta
def-value (-> def-class (.getField &/value-field) (.get nil))]
def-type (&a-module/def-type r-module r-name)
_ (&/without-repl-closure
- (&a-module/define module-name ?name def-type def-meta def-value))]
+ (&a-module/define module-name ?name def-type ?meta def-value))]
(return nil))
(&/fail-with-loc (str "[Compilation Error] Aliases cannot contain meta-data: " (str module-name &/+name-separator+ ?name)))))
diff --git a/luxc/src/lux/type.clj b/luxc/src/lux/type.clj
index 20126417f..fc1736a1c 100644
--- a/luxc/src/lux/type.clj
+++ b/luxc/src/lux/type.clj
@@ -40,20 +40,8 @@
(def Text (&/$Named (&/T ["lux" "Text"]) (&/$Primitive "#Text" &/$Nil)))
(def Ident (&/$Named (&/T ["lux" "Ident"]) (&/$Product Text Text)))
-(do-template [<name> <tag>]
- (defn <name> [elemT]
- (&/$Primitive <tag> (&/|list elemT)))
-
- Array "#Array"
- Atom "#Atom"
- )
-
-(do-template [<name> <tag>]
- (defn <name> [threadT elemT]
- (&/$Primitive <tag> (&/|list threadT elemT)))
-
- Box "#Box"
- )
+(defn Array [elemT]
+ (&/$Primitive "#Array" (&/|list elemT)))
(def Nothing
(&/$Named (&/T ["lux" "Nothing"])