aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lux/base.clj2
-rw-r--r--src/lux/compiler/host.clj9
-rw-r--r--src/lux/compiler/lux.clj13
3 files changed, 12 insertions, 12 deletions
diff --git a/src/lux/base.clj b/src/lux/base.clj
index aead20b41..05668a245 100644
--- a/src/lux/base.clj
+++ b/src/lux/base.clj
@@ -160,7 +160,7 @@
(to-array (conj elems product-tag))))
(defn V [^Long tag value]
- (to-array [sum-tag (int tag) false value]))
+ (to-array [sum-tag (int tag) nil value]))
;; Constructors
(def None$ (V $None unit-tag))
diff --git a/src/lux/compiler/host.clj b/src/lux/compiler/host.clj
index 2e584c7c6..2514dfaa5 100644
--- a/src/lux/compiler/host.clj
+++ b/src/lux/compiler/host.clj
@@ -802,9 +802,8 @@
(.visitFrame Opcodes/F_NEW (int 2) (to-array ["[Ljava/lang/Object;" Opcodes/INTEGER]) (int 2) (to-array [Opcodes/INTEGER Opcodes/INTEGER]))
(.visitVarInsn Opcodes/ALOAD 0) ;; tag, sum-tag, sum
(.visitLdcInsn (int 2)) ;; tag, sum-tag, sum, last-index?
- (.visitInsn Opcodes/AALOAD) ;; tag, sum-tag, last?'
- &&/unwrap-boolean ;; tag, sum-tag, last?
- (.visitJumpInsn Opcodes/IFEQ $not-right) ;; tag, sum-tag
+ (.visitInsn Opcodes/AALOAD) ;; tag, sum-tag, last?
+ (.visitJumpInsn Opcodes/IFNULL $not-right) ;; tag, sum-tag
(.visitInsn Opcodes/ISUB) ;; sub-tag
(.visitVarInsn Opcodes/ALOAD 0) ;; sub-tag, sum
(.visitLdcInsn (int 3)) ;; sub-tag, sum, sub-sum-idx
@@ -821,7 +820,7 @@
(.visitMaxs 0 0)
(.visitEnd)))
=sum-make-method (let [$is-null (new Label)]
- (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "sum_make" "(ILjava/lang/Boolean;Ljava/lang/Object;)[Ljava/lang/Object;" nil nil)
+ (doto (.visitMethod =class (+ Opcodes/ACC_PUBLIC Opcodes/ACC_STATIC) "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;" nil nil)
(.visitCode)
(.visitVarInsn Opcodes/ALOAD 2)
(.visitJumpInsn Opcodes/IFNULL $is-null)
@@ -845,7 +844,7 @@
(.visitVarInsn Opcodes/ALOAD 2)
(.visitInsn Opcodes/AASTORE)
(.visitInsn Opcodes/ARETURN)
- (.visitFrame Opcodes/F_NEW (int 3) (to-array [Opcodes/INTEGER "java/lang/Boolean" "java/lang/Object"]) (int 0) (to-array []))
+ (.visitFrame Opcodes/F_NEW (int 3) (to-array [Opcodes/INTEGER "java/lang/Object" "java/lang/Object"]) (int 0) (to-array []))
(.visitLabel $is-null)
(.visitTypeInsn Opcodes/NEW "java/lang/IllegalStateException")
(.visitInsn Opcodes/DUP)
diff --git a/src/lux/compiler/lux.clj b/src/lux/compiler/lux.clj
index dba42eb21..87de12497 100644
--- a/src/lux/compiler/lux.clj
+++ b/src/lux/compiler/lux.clj
@@ -83,13 +83,14 @@
(.visitInsn Opcodes/AASTORE))]]
(return nil)))))
-(defn compile-variant [compile ?tag tail? ?value]
+(defn compile-variant [compile tag tail? value]
(|do [^MethodVisitor *writer* &/get-writer
- :let [_ (doto *writer*
- (.visitLdcInsn (int ?tag))
- (.visitFieldInsn Opcodes/GETSTATIC "java/lang/Boolean" (if tail? "TRUE" "FALSE") "Ljava/lang/Boolean;"))]
- _ (compile ?value)
- :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESTATIC "lux/LuxUtils" "sum_make" "(ILjava/lang/Boolean;Ljava/lang/Object;)[Ljava/lang/Object;")]]
+ :let [_ (.visitLdcInsn *writer* (int tag))
+ _ (if tail?
+ (.visitLdcInsn *writer* "")
+ (.visitInsn *writer* Opcodes/ACONST_NULL))]
+ _ (compile value)
+ :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESTATIC "lux/LuxUtils" "sum_make" "(ILjava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;")]]
(return nil)))
(defn compile-local [compile ?idx]