diff options
Diffstat (limited to 'src/cmd/gc/dcl.c')
-rw-r--r-- | src/cmd/gc/dcl.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/cmd/gc/dcl.c b/src/cmd/gc/dcl.c index d3759efde..c7d13ef06 100644 --- a/src/cmd/gc/dcl.c +++ b/src/cmd/gc/dcl.c @@ -141,6 +141,8 @@ testdclstack(void) for(d=dclstack; d!=S; d=d->link) { if(d->name == nil) { + if(nerrors != 0) + errorexit(); yyerror("mark left on the stack"); continue; } @@ -287,7 +289,7 @@ variter(NodeList *vl, Node *t, NodeList *el) for(; vl; vl=vl->next) { if(doexpr) { if(el == nil) { - yyerror("missing expr in var dcl"); + yyerror("missing expression in var declaration"); break; } e = el->n; @@ -310,7 +312,7 @@ variter(NodeList *vl, Node *t, NodeList *el) } } if(el != nil) - yyerror("extra expr in var dcl"); + yyerror("extra expression in var declaration"); return init; } @@ -327,7 +329,7 @@ constiter(NodeList *vl, Node *t, NodeList *cl) vv = nil; if(cl == nil) { if(t != N) - yyerror("constdcl cannot have type without expr"); + yyerror("const declaration cannot have type without expression"); cl = lastconst; t = lasttype; } else { @@ -338,7 +340,7 @@ constiter(NodeList *vl, Node *t, NodeList *cl) for(; vl; vl=vl->next) { if(cl == nil) { - yyerror("missing expr in const dcl"); + yyerror("missing value in const declaration"); break; } c = cl->n; @@ -354,7 +356,7 @@ constiter(NodeList *vl, Node *t, NodeList *cl) vv = list(vv, nod(ODCLCONST, v, N)); } if(cl != nil) - yyerror("extra expr in const dcl"); + yyerror("extra expression in const declaration"); iota += 1; return vv; } @@ -1019,7 +1021,7 @@ tointerface(NodeList *l) } Node* -embedded(Sym *s) +embedded(Sym *s, Pkg *pkg) { Node *n; char *name; @@ -1036,9 +1038,9 @@ embedded(Sym *s) if(exportname(name)) n = newname(lookup(name)); - else if(s->pkg == builtinpkg && importpkg != nil) - // The name of embedded builtins during imports belongs to importpkg. - n = newname(pkglookup(name, importpkg)); + else if(s->pkg == builtinpkg) + // The name of embedded builtins belongs to pkg. + n = newname(pkglookup(name, pkg)); else n = newname(pkglookup(name, s->pkg)); n = nod(ODCLFIELD, n, oldname(s)); |