aboutsummaryrefslogtreecommitdiff
path: root/lux-bootstrapper
diff options
context:
space:
mode:
Diffstat (limited to 'lux-bootstrapper')
-rw-r--r--lux-bootstrapper/src/lux/analyser/proc/common.clj7
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj30
2 files changed, 22 insertions, 15 deletions
diff --git a/lux-bootstrapper/src/lux/analyser/proc/common.clj b/lux-bootstrapper/src/lux/analyser/proc/common.clj
index 8dea7bd3b..946c217a7 100644
--- a/lux-bootstrapper/src/lux/analyser/proc/common.clj
+++ b/lux-bootstrapper/src/lux/analyser/proc/common.clj
@@ -45,13 +45,12 @@
)
(defn- analyse-text-concat [analyse exo-type ?values]
- (|do [:let [(&/$Item parameter (&/$Item subject (&/$End))) ?values]
- =parameter (&&/analyse-1 analyse &type/Text parameter)
- =subject (&&/analyse-1 analyse &type/Text subject)
+ (|do [=values (&/map% (fn [it] (&&/analyse-1 analyse &type/Text it))
+ ?values)
_ (&type/check exo-type &type/Text)
_location &/location]
(return (&/|list (&&/|meta exo-type _location
- (&&/$proc (&/T ["text" "concat"]) (&/|list =parameter =subject) (&/|list)))))))
+ (&&/$proc (&/T ["text" "concat"]) =values (&/|list)))))))
(defn- analyse-text-index [analyse exo-type ?values]
(|do [:let [(&/$Item start (&/$Item part (&/$Item text (&/$End)))) ?values]
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj b/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
index fc1257a3e..4623c21e4 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/proc/common.clj
@@ -222,17 +222,25 @@
(return nil)))
(defn compile-text-concat [compile ?values special-args]
- (|do [:let [(&/$Item ?x (&/$Item ?y (&/$End))) ?values]
- ^MethodVisitor *writer* &/get-writer
- _ (compile ?x)
- :let [_ (doto *writer*
- (.visitTypeInsn Opcodes/CHECKCAST "java/lang/String"))]
- _ (compile ?y)
- :let [_ (doto *writer*
- (.visitTypeInsn Opcodes/CHECKCAST "java/lang/String"))]
- :let [_ (doto *writer*
- (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/String" "concat" "(Ljava/lang/String;)Ljava/lang/String;"))]]
- (return nil)))
+ (|do [^MethodVisitor *writer* &/get-writer
+ =values (&/map% (fn [it]
+ (|do [_ (compile it)]
+ (return (doto *writer*
+ (.visitTypeInsn Opcodes/CHECKCAST "java/lang/String")))))
+ ?values)]
+ (return (|case =values
+ (&/$End)
+ (.visitLdcInsn *writer* "")
+
+ (&/$Item head tail)
+ (loop [tail tail]
+ (|case tail
+ (&/$End)
+ nil
+
+ (&/$Item head* tail*)
+ (do (.visitMethodInsn *writer* Opcodes/INVOKEVIRTUAL "java/lang/String" "concat" "(Ljava/lang/String;)Ljava/lang/String;")
+ (recur tail*))))))))
(defn compile-text-clip [compile ?values special-args]
(|do [:let [(&/$Item ?text (&/$Item ?offset (&/$Item ?length (&/$End)))) ?values]