aboutsummaryrefslogtreecommitdiff
path: root/luxc/src
diff options
context:
space:
mode:
Diffstat (limited to 'luxc/src')
-rw-r--r--luxc/src/lux/analyser.clj7
-rw-r--r--luxc/src/lux/analyser/jvm.clj2
-rw-r--r--luxc/src/lux/analyser/lux.clj4
-rw-r--r--luxc/src/lux/compiler/jvm.clj1
4 files changed, 8 insertions, 6 deletions
diff --git a/luxc/src/lux/analyser.clj b/luxc/src/lux/analyser.clj
index 50edefac4..d895b1aaa 100644
--- a/luxc/src/lux/analyser.clj
+++ b/luxc/src/lux/analyser.clj
@@ -60,7 +60,8 @@
(|let [analyse (partial analyse-ast optimize eval! compile-module compilers)
[cursor token] ?token
compile-def (aget compilers 0)
- compile-program (aget compilers 1)]
+ compile-program (aget compilers 1)
+ macro-wrapper (aget compilers 2)]
(|case token
;; Standard special forms
(&/$BoolS ?value)
@@ -171,7 +172,7 @@
;; else
(&/with-cursor cursor
(|do [=fn (just-analyse analyse (&/T [command-meta command]))]
- (&&lux/analyse-apply analyse cursor exo-type =fn parameters))))
+ (&&lux/analyse-apply analyse cursor exo-type macro-wrapper =fn parameters))))
(&/$NatS idx)
(&/with-analysis-meta cursor exo-type
@@ -184,7 +185,7 @@
_
(&/with-cursor cursor
(|do [=fn (just-analyse analyse (&/T [command-meta command]))]
- (&&lux/analyse-apply analyse cursor exo-type =fn parameters))))
+ (&&lux/analyse-apply analyse cursor exo-type macro-wrapper =fn parameters))))
_
(&/fail-with-loc (str "[Analyser Error] Unknown syntax: " (prn-str (&/show-ast (&/T [(&/T ["" -1 -1]) token])))))
diff --git a/luxc/src/lux/analyser/jvm.clj b/luxc/src/lux/analyser/jvm.clj
index 5ea64d41a..b82c634d6 100644
--- a/luxc/src/lux/analyser/jvm.clj
+++ b/luxc/src/lux/analyser/jvm.clj
@@ -1142,7 +1142,7 @@
)
(defn analyse-host [analyse exo-type compilers category proc ?values]
- (|let [[_ _ compile-class compile-interface] compilers]
+ (|let [[_ _ _ compile-class compile-interface] compilers]
(case category
"lux"
(case proc
diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj
index 27f4ee11e..b990b738c 100644
--- a/luxc/src/lux/analyser/lux.clj
+++ b/luxc/src/lux/analyser/lux.clj
@@ -375,7 +375,7 @@
(&&/$apply =fn =args)
)))))
-(defn analyse-apply [analyse cursor exo-type =fn ?args]
+(defn analyse-apply [analyse cursor exo-type macro-wrapper =fn ?args]
(|do [loader &/loader
:let [[[=fn-type =fn-cursor] =fn-form] =fn]]
(|case =fn-form
@@ -384,7 +384,7 @@
(|case (&&meta/meta-get &&meta/macro?-tag ?meta)
(&/$Some _)
(|do [macro-expansion (fn [state]
- (|case (-> ?value (.apply ?args) (.apply state))
+ (|case ((macro-wrapper ?value) ?args state)
(&/$Right state* output)
(&/$Right (&/T [state* output]))
diff --git a/luxc/src/lux/compiler/jvm.clj b/luxc/src/lux/compiler/jvm.clj
index 809c03022..a5c5ee210 100644
--- a/luxc/src/lux/compiler/jvm.clj
+++ b/luxc/src/lux/compiler/jvm.clj
@@ -161,6 +161,7 @@
(let [compile-expression* (partial compile-expression nil)]
(&/T [(partial &&lux/compile-def compile-expression)
(partial &&lux/compile-program compile-expression*)
+ (fn [macro] (fn [args state] (-> macro (.apply args) (.apply state))))
(partial &&host/compile-jvm-class compile-expression*)
&&host/compile-jvm-interface])))