diff --git a/transpile/service.go b/transpile/service.go index b608d47..c252a88 100644 --- a/transpile/service.go +++ b/transpile/service.go @@ -385,7 +385,7 @@ func handleBlockStmt(body *ast.BlockStmt) string { } func handleBranchStmt(stmt *ast.BranchStmt) string { - return "break;" + return stmt.Tok.String() + ";" } func handleCaseClause(cc *ast.CaseClause) string { diff --git a/transpile/service_test.go b/transpile/service_test.go index 2a6ebfe..e8fad3b 100644 --- a/transpile/service_test.go +++ b/transpile/service_test.go @@ -859,6 +859,32 @@ var _ = Describe("Go Translator", func() { ` Compare(source, expected) }) + It("for { continue }", func() { + source := `package test + func Setup() {} + func Loop() { + for { + if v == 0 { + continue + } + } + } + ` + expected := ` + void setup(); + void loop(); + + void setup() {} + void loop() { + while (1) { + if (v == 0) { + continue; + } + } + } + ` + Compare(source, expected) + }) }) Describe("Действия", func() { It("nil -> NULL", func() {