rewrite switch statments using if..else for haxe3 compatibility