aboutsummaryrefslogtreecommitdiff
path: root/src/lang/compiler.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/lang/compiler.clj')
-rw-r--r--src/lang/compiler.clj16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lang/compiler.clj b/src/lang/compiler.clj
index 83ce18ab1..e7d1ed582 100644
--- a/src/lang/compiler.clj
+++ b/src/lang/compiler.clj
@@ -70,8 +70,17 @@
;; [Utils/Compilers]
(defcompiler ^:private compile-literal
[::&analyser/literal ?literal]
- (cond (string? ?literal)
- (.visitLdcInsn *writer* ?literal)
+ (cond (instance? java.lang.Integer ?literal)
+ (doto *writer*
+ (.visitTypeInsn Opcodes/NEW (->class "java.lang.Integer"))
+ (.visitInsn Opcodes/DUP)(.visitLdcInsn ?literal)
+ (.visitMethodInsn Opcodes/INVOKESPECIAL (->class "java.lang.Integer") "<init>" "(I)V"))
+
+ (instance? java.lang.Float ?literal)
+ (doto *writer*
+ (.visitTypeInsn Opcodes/NEW (->class "java.lang.Float"))
+ (.visitInsn Opcodes/DUP)(.visitLdcInsn ?literal)
+ (.visitMethodInsn Opcodes/INVOKESPECIAL (->class "java.lang.Float") "<init>" "(F)V"))
(instance? java.lang.Boolean ?literal)
(if ?literal
@@ -80,6 +89,9 @@
;; (.visitLdcInsn *writer* (int 0))
(.visitFieldInsn *writer* Opcodes/GETSTATIC (->class "java.lang.Boolean") "FALSE" (->type-signature "java.lang.Boolean")))
+ (string? ?literal)
+ (.visitLdcInsn *writer* ?literal)
+
:else
(assert false (str "[Unknown literal type] " ?literal " : " (class ?literal)))))