]> Cypherpunks repositories - gostls13.git/commitdiff
gc: issue 901
authorRuss Cox <rsc@golang.org>
Thu, 15 Jul 2010 22:22:51 +0000 (15:22 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 15 Jul 2010 22:22:51 +0000 (15:22 -0700)
Fixes #901.

R=ken2
CC=golang-dev
https://golang.org/cl/1674049

src/cmd/gc/walk.c

index 8b8096400e623b4fa16da11ff82e4abb4ba3e92d..50d2ba3ea10229b71cf242eb00d69d819815a3e4 100644 (file)
@@ -281,6 +281,13 @@ walkdef(Node *n)
                if(n->defn == N) {
                        if(n->etype != 0)       // like OPRINTN
                                break;
+                       if(nerrors > 0) {
+                               // Can have undefined variables in x := foo
+                               // that make x have an n->ndefn == nil.
+                               // If there are other errors anyway, don't
+                               // bother adding to the noise.
+                               break;
+                       }
                        fatal("var without type, init: %S", n->sym);
                }
                if(n->defn->op == ONAME) {