diff --git a/tests/code_quality/for.expected.c b/tests/code_quality/for.expected.c index e47929222..5f6808746 100644 --- a/tests/code_quality/for.expected.c +++ b/tests/code_quality/for.expected.c @@ -1,5 +1,5 @@ /* - Package main - transpiled by c2go version: v0.22.4 Aluminium 2018-04-24 + Package main - transpiled by c2go version: v0.23.0 Berkelium 2018-04-27 If you have found any issues, please raise an issue at: https://github.com/elliotchance/c2go/ diff --git a/tests/code_quality/if.expected.c b/tests/code_quality/if.expected.c index 47c64a923..76be90723 100644 --- a/tests/code_quality/if.expected.c +++ b/tests/code_quality/if.expected.c @@ -1,5 +1,5 @@ /* - Package main - transpiled by c2go version: v0.22.4 Aluminium 2018-04-24 + Package main - transpiled by c2go version: v0.23.0 Berkelium 2018-04-27 If you have found any issues, please raise an issue at: https://github.com/elliotchance/c2go/ diff --git a/tests/code_quality/operators.expected.c b/tests/code_quality/operators.expected.c index 84520a95c..4e57f2c37 100644 --- a/tests/code_quality/operators.expected.c +++ b/tests/code_quality/operators.expected.c @@ -1,5 +1,5 @@ /* - Package main - transpiled by c2go version: v0.22.4 Aluminium 2018-04-24 + Package main - transpiled by c2go version: v0.23.0 Berkelium 2018-04-27 If you have found any issues, please raise an issue at: https://github.com/elliotchance/c2go/ diff --git a/tests/code_quality/switch.expected.c b/tests/code_quality/switch.expected.c index df8d9295b..e8a0dc18a 100644 --- a/tests/code_quality/switch.expected.c +++ b/tests/code_quality/switch.expected.c @@ -1,5 +1,5 @@ /* - Package main - transpiled by c2go version: v0.22.4 Aluminium 2018-04-24 + Package main - transpiled by c2go version: v0.23.0 Berkelium 2018-04-27 If you have found any issues, please raise an issue at: https://github.com/elliotchance/c2go/ @@ -28,7 +28,11 @@ func switch_function() { return } case int32(4): + { + } case int32(5): + { + } case int32(6): fallthrough case int32(7): diff --git a/tests/switch.c b/tests/switch.c index 5a6a1e86f..5d3289410 100644 --- a/tests/switch.c +++ b/tests/switch.c @@ -316,7 +316,6 @@ void scoped_fallthrough_several_midway_default() } } - void scoped_goto_label(bool use_goto) { for (;;) { @@ -352,7 +351,11 @@ void scoped_goto_label(bool use_goto) break; } case 2: - {} + { + int x = 0; + printf("%d", x); + break; + } LABELX: {} default: { diff --git a/transpiler/switch.go b/transpiler/switch.go index dfd1acb45..752cbc395 100644 --- a/transpiler/switch.go +++ b/transpiler/switch.go @@ -196,7 +196,8 @@ func transpileSwitchStmt(n *ast.SwitchStmt, p *program.Program) ( if vv, ok := v.List[len(v.List)-1].(*goast.BranchStmt); ok { if vv.Tok == token.BREAK { if isFallThrough { - cs.Body = append(v.List[:len(v.List)-1]) + v.List = v.List[:len(v.List)-1] + cs.Body = body[:len(body)-1] continue } }