shithub: mc

Download patch

ref: ac3864801e143fa8b85ec369b8bdc3d34222b0c2
parent: 3872f3ace46e4875e457826e012c03f969e81617
author: Ori Bernstein <[email protected]>
date: Mon Jul 9 11:02:12 EDT 2012

Fix writing literal arrays.

--- a/8/isel.c
+++ b/8/isel.c
@@ -750,9 +750,14 @@
     }
 }
 
+void breakhere(){}
+
 static void writelit(FILE *fd, Node *v)
 {
     char lbl[128];
+    size_t i;
+
+    assert(v->type == Nlit);
     switch (v->lit.littype) {
         case Lbool:     fprintf(fd, "\t.long %d\n", v->lit.boolval);     break;
         case Lchr:      fprintf(fd, "\t.byte %d\n",  v->lit.chrval);     break;
@@ -764,6 +769,9 @@
                         writeblob(fd, v->lit.strval, strlen(v->lit.strval));
                         break;
         case Lseq:
+            for (i = 0; i < v->lit.nelt; i++)
+                writelit(fd, v->lit.seqval[i]->expr.args[0]);
+            break;
         case Lfunc:
                         die("Generating this shit ain't ready yet ");
     }
--- a/test/tests
+++ b/test/tests
@@ -47,7 +47,7 @@
 B matchargunion	E	69
 B matchbind	E	8
 B arraylit	E	3
-B arraylit-ni	E	3
+B arraylit-ni	E	2
 B structlit	E	42
 F declmismatch
 F infermismatch