aboutsummaryrefslogtreecommitdiff
path: root/luxc/src
diff options
context:
space:
mode:
authorEduardo Julian2017-11-14 14:59:45 -0400
committerEduardo Julian2017-11-14 14:59:45 -0400
commit686a46f569b818681583e6ce75b37b25642b375b (patch)
treeee3c9d368ad6c89ce1475c34a2dc87e860f33279 /luxc/src
parent72603f38074a67f9ab1e53df1b5fb5da3836162d (diff)
- Removed "lux text last-index" procedure.
- Removed "lux text trim" procedure. - Modified "lux text clip" procedure. - Some bug fixes.
Diffstat (limited to 'luxc/src')
-rw-r--r--luxc/src/lux/analyser/proc/common.clj4
-rw-r--r--luxc/src/lux/compiler/jvm/proc/common.clj4
-rw-r--r--luxc/src/lux/compiler/jvm/rt.clj31
3 files changed, 11 insertions, 28 deletions
diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj
index 182c08d63..a1758f845 100644
--- a/luxc/src/lux/analyser/proc/common.clj
+++ b/luxc/src/lux/analyser/proc/common.clj
@@ -58,7 +58,6 @@
(&/|list)))))))
^:private analyse-text-index "index" (&/$Apply &type/Nat &type/Maybe)
- ^:private analyse-text-last-index "last-index" (&/$Apply &type/Nat &type/Maybe)
)
(defn ^:private analyse-text-contains? [analyse exo-type ?values]
@@ -77,7 +76,7 @@
=text (&&/analyse-1 analyse &type/Text text)
=from (&&/analyse-1 analyse &type/Nat from)
=to (&&/analyse-1 analyse &type/Nat to)
- _ (&type/check exo-type (&/$Apply &type/Text &type/Maybe))
+ _ (&type/check exo-type &type/Text)
_cursor &/cursor]
(return (&/|list (&&/|meta exo-type _cursor
(&&/$proc (&/T ["text" "clip"])
@@ -489,7 +488,6 @@
"lux text concat" (analyse-text-concat analyse exo-type ?values)
"lux text clip" (analyse-text-clip analyse exo-type ?values)
"lux text index" (analyse-text-index analyse exo-type ?values)
- "lux text last-index" (analyse-text-last-index analyse exo-type ?values)
"lux text size" (analyse-text-size analyse exo-type ?values)
"lux text hash" (analyse-text-hash analyse exo-type ?values)
"lux text replace-all" (analyse-text-replace-all analyse exo-type ?values)
diff --git a/luxc/src/lux/compiler/jvm/proc/common.clj b/luxc/src/lux/compiler/jvm/proc/common.clj
index d7821e9af..e925c7fc0 100644
--- a/luxc/src/lux/compiler/jvm/proc/common.clj
+++ b/luxc/src/lux/compiler/jvm/proc/common.clj
@@ -512,7 +512,7 @@
&&/unwrap-long
(.visitInsn Opcodes/L2I))]
:let [_ (doto *writer*
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "text_clip" "(Ljava/lang/String;II)[Ljava/lang/Object;"))]]
+ (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "text_clip" "(Ljava/lang/String;II)Ljava/lang/String;"))]]
(return nil)))
(do-template [<name> <method>]
@@ -548,7 +548,6 @@
(return nil)))
^:private compile-text-index "indexOf"
- ^:private compile-text-last-index "lastIndexOf"
)
(do-template [<name> <class> <method>]
@@ -828,7 +827,6 @@
"concat" (compile-text-concat compile ?values special-args)
"clip" (compile-text-clip compile ?values special-args)
"index" (compile-text-index compile ?values special-args)
- "last-index" (compile-text-last-index compile ?values special-args)
"size" (compile-text-size compile ?values special-args)
"hash" (compile-text-hash compile ?values special-args)
"replace-all" (compile-text-replace-all compile ?values special-args)
diff --git a/luxc/src/lux/compiler/jvm/rt.clj b/luxc/src/lux/compiler/jvm/rt.clj
index 83f02af3e..c26265f87 100644
--- a/luxc/src/lux/compiler/jvm/rt.clj
+++ b/luxc/src/lux/compiler/jvm/rt.clj
@@ -667,28 +667,15 @@
nil))
(defn ^:private compile-LuxRT-text-methods [^ClassWriter =class]
- (do (let [$from (new Label)
- $to (new Label)
- $handler (new Label)
- $end (new Label)]
- (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "text_clip" "(Ljava/lang/String;II)[Ljava/lang/Object;" nil nil)
- (.visitCode)
- (.visitTryCatchBlock $from $to $handler "java/lang/IndexOutOfBoundsException")
- (.visitLabel $from)
- (.visitVarInsn Opcodes/ALOAD 0)
- (.visitVarInsn Opcodes/ILOAD 1)
- (.visitVarInsn Opcodes/ILOAD 2)
- (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/String" "substring" "(II)Ljava/lang/String;")
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "make_some" "(Ljava/lang/Object;)[Ljava/lang/Object;")
- (.visitJumpInsn Opcodes/GOTO $end)
- (.visitLabel $to)
- (.visitLabel $handler)
- (.visitInsn Opcodes/POP)
- (.visitMethodInsn Opcodes/INVOKESTATIC "lux/LuxRT" "make_none" "()[Ljava/lang/Object;")
- (.visitLabel $end)
- (.visitInsn Opcodes/ARETURN)
- (.visitMaxs 0 0)
- (.visitEnd)))
+ (do (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "text_clip" "(Ljava/lang/String;II)Ljava/lang/String;" nil nil)
+ (.visitCode)
+ (.visitVarInsn Opcodes/ALOAD 0)
+ (.visitVarInsn Opcodes/ILOAD 1)
+ (.visitVarInsn Opcodes/ILOAD 2)
+ (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/String" "substring" "(II)Ljava/lang/String;")
+ (.visitInsn Opcodes/ARETURN)
+ (.visitMaxs 0 0)
+ (.visitEnd))
(let [$from (new Label)
$to (new Label)
$handler (new Label)]