void walkswitch(Node *sw) { /* * reorder the body into (OLIST, cases, statements) * cases have OGOTO into statements. * both have inserted OBREAK statements */ if(sw->ntest == N) { sw->ntest = nodbool(1); typecheck(&sw->ntest, Erv); } if(sw->ntest->op == OTYPESW) { typeswitch(sw); //dump("sw", sw); return; } exprswitch(sw); }
void walkswitch(Node *sw) { /* * reorder the body into (OLIST, cases, statements) * cases have OGOTO into statements. * both have inserted OBREAK statements */ if(sw->ntest == N) { sw->ntest = nodbool(1); typecheck(&sw->ntest, Erv); } if(sw->ntest->op == OTYPESW) { typeswitch(sw); //dump("sw", sw); return; } exprswitch(sw); // Discard old AST elements after a walk. They can confuse racewealk. sw->ntest = nil; sw->list = nil; }