shithub: mc

Download patch

ref: 99e0ccb6af41fe98470068acf846634ae19c8810
parent: fa1371e250b1b0129057bfe16c3f688685b0df4f
author: Ori Bernstein <[email protected]>
date: Sat Mar 10 12:27:15 EST 2012

Handle const/globl/local properly

--- a/parse/dump.c
+++ b/parse/dump.c
@@ -35,6 +35,10 @@
     char buf[1024];
 
     indent(fd, depth);
+    if (s->isconst)
+        fprintf(fd, "const ");
+    else
+        fprintf(fd, "var ");
     outname(s->name, fd);
     fprintf(fd, " : %s\n", tyfmt(buf, 1024, s->type));
 }
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -172,7 +172,8 @@
             {$2->decl.flags = 0;
              $$ = $2;}
         | TConst declbody TEndln
-            {$2->decl.flags = Dclconst;
+            {$2->decl.sym->isconst = 1;
+             $2->decl.flags = 0;
              $$ = $2;}
         | TExtern TVar declbody TEndln
             {$3->decl.flags = Dclextern;