waneck / haxe-genc

20 stars 2 forks source link

switch on string generates invalid code if case has no expression #33

Closed Simn closed 9 years ago

Simn commented 9 years ago
class Main {
    static public function main() {
        var s = getString();
        switch (s) {
            case "foo":
            case "bar":
        }
    }

    static function getString() {
        return "miauga";
    }
}
void Main_main(){
    String* _g;
    String* s;
    String* _g1;
    _g = Main_getString();
    s = _g;
    _g1 = s;
    switch(((_g1))->length){
        case 3: {
            if(String_equals((_g1),HX_STR("foo")) == 1) else {
                if(String_equals((_g1),HX_STR("bar")) == 1);
            }
            break;
        }
    }
}

This leads to an else without if error.