cgen: fix a goto error

pull/4863/head
Kris Cherven 2020-05-11 17:49:08 -04:00 committed by GitHub
parent e6bc18b21b
commit d359a7aefb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -626,7 +626,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
g.go_stmt(it)
}
ast.GotoLabel {
g.writeln('$it.name:')
g.writeln('$it.name: {}')
}
ast.GotoStmt {
g.writeln('goto $it.name;')

View File

@ -0,0 +1,10 @@
fn test_goto() {
mut i := 0
a: b := 1
_ = b
i++
if i < 3 {
goto a
}
assert i == 3
}