set beginCase/endCase only if switch/for is flattened