Use emit-switch in following code