aboutsummaryrefslogtreecommitdiff
path: root/luxc
diff options
context:
space:
mode:
authorEduardo Julian2016-12-20 19:50:12 -0400
committerEduardo Julian2016-12-20 19:50:12 -0400
commitb69495d6d3098ea39af5467063904b023a08adc0 (patch)
treedc49d144c28b871977e576e42eac9066124dac6b /luxc
parent6a1bcea931b6ce76051de91d5a67c37b83adf29d (diff)
- Fixed a bug in Frac encoding, where the prefix dot was not being added for non-zero numbers.
Diffstat (limited to '')
-rw-r--r--luxc/src/lux/compiler/host.clj12
1 files changed, 7 insertions, 5 deletions
diff --git a/luxc/src/lux/compiler/host.clj b/luxc/src/lux/compiler/host.clj
index 3d4172110..26fbda4db 100644
--- a/luxc/src/lux/compiler/host.clj
+++ b/luxc/src/lux/compiler/host.clj
@@ -939,15 +939,16 @@
(.visitInsn Opcodes/ARETURN)
(.visitMaxs 0 0)
(.visitEnd)))
- _ (let [$is-zero (new Label)
- $end (new Label)]
+ _ (let [$is-zero (new Label)]
(doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "encode_frac" "(J)Ljava/lang/String;" nil nil)
(.visitCode)
(.visitVarInsn Opcodes/LLOAD 0)
(.visitLdcInsn (long 0))
(.visitInsn Opcodes/LCMP)
(.visitJumpInsn Opcodes/IFEQ $is-zero)
- ;; IF =/= 0
+ ;; IF != 0
+ ;; Add prefix dot for later usage.
+ (.visitLdcInsn ".")
;; Generate leading 0s
(.visitLdcInsn (long 1))
(.visitVarInsn Opcodes/LLOAD 0)
@@ -964,12 +965,13 @@
(.visitInsn Opcodes/AALOAD)
;; Join leading 0s with number text
(.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/String" "concat" "(Ljava/lang/String;)Ljava/lang/String;")
+ ;; Join with prefix dot
+ (.visitMethodInsn Opcodes/INVOKEVIRTUAL "java/lang/String" "concat" "(Ljava/lang/String;)Ljava/lang/String;")
;; FINISH
- (.visitJumpInsn Opcodes/GOTO $end)
+ (.visitInsn Opcodes/ARETURN)
;; IF == 0
(.visitLabel $is-zero)
(.visitLdcInsn ".0")
- (.visitLabel $end)
(.visitInsn Opcodes/ARETURN)
(.visitMaxs 0 0)
(.visitEnd)))