mirror of
https://github.com/golang/go
synced 2024-11-22 05:44:41 -07:00
empty switches -- bug128
R=r OCL=20520 CL=20522
This commit is contained in:
parent
c597845e13
commit
a0a14b98fa
@ -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");
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user