for code like this:
switch (foo)
{ case 1:
CODE1
case 2:
CODE2
break;
case 3:
CODE3
break;
}
Here is the pseudocode:
break = false
fall_thru = false;
if (!break && (foo == 1 || fall_thru))
CODE 1
fall_thru = true;
endif
if (!break && (foo == 2 || fall_thru))
CODE 2
fall_thru = true;
break = true; // emitted when 'break' is hit
fall_thru = false; // emitted when 'break' is hit
endif
-- MattWalsh - 08 Feb 2010