]> Cypherpunks repositories - gostls13.git/commitdiff
assignment count mismatch: 2 = 1.
authorRuss Cox <rsc@golang.org>
Tue, 27 Jan 2009 01:20:29 +0000 (17:20 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 27 Jan 2009 01:20:29 +0000 (17:20 -0800)
R=ken
OCL=23534
CL=23534

src/cmd/gc/go.h
src/cmd/gc/walk.c

index 461c00b217b7d284987eb86535b4d40aa883746d..abb08ebe2d0f87a58946f3b9b16f85d71006608b 100644 (file)
@@ -185,6 +185,7 @@ struct      Node
        uchar   iota;           // OLITERAL made from iota
        uchar   embedded;       // ODCLFIELD embedded type
        uchar   colas;          // OAS resulting from :=
+       uchar   diag;           // already printed error about this
 
        // most nodes
        Node*   left;
index 48ab2a6c99ca2aaaee0885189ba252d1054329ac..99fe055ea2b677b93f89501dc1e43cd0bbdf7de9 100644 (file)
@@ -534,8 +534,10 @@ loop:
                        }
                        break;
                }
-
-               yyerror("bad shape across assignment - cr=%d cl=%d\n", cr, cl);
+               if(l->diag == 0) {
+                       l->diag = 1;
+                       yyerror("assignment count mismatch: %d = %d", cl, cr);
+               }
                goto ret;
 
        case OBREAK:
@@ -3083,7 +3085,10 @@ multi:
        return n;
 
 badt:
-       yyerror("shape error across :=");
+       if(nl->diag == 0) {
+               nl->diag = 1;
+               yyerror("assignment count mismatch: %d = %d", cl, cr);
+       }
        return nl;
 }