1
0
mirror of https://github.com/golang/go synced 2024-11-22 00:24:41 -07:00

empty switches -- bug128

R=r
OCL=20520
CL=20522
This commit is contained in:
Ken Thompson 2008-12-04 16:05:40 -08:00
parent c597845e13
commit a0a14b98fa
2 changed files with 3 additions and 3 deletions

View File

@ -536,6 +536,8 @@ swgen(Node *n)
c1 = listfirst(&save1, &n->nbody);
while(c1 != N) {
setlineno(c1);
if(c1->op == OEMPTY)
break;
if(c1->op != OCASE) {
if(s0 == C && dflt == P)
yyerror("unreachable statements in a switch");

View File

@ -277,9 +277,7 @@ loop:
if(top != Etop)
goto nottop;
if(!casebody(n->nbody))
yyerror("switch statement must have case labels");
casebody(n->nbody);
if(n->ntest == N)
n->ntest = booltrue;
walkstate(n->ninit);