mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix a goto error
This commit is contained in:
parent
e6bc18b21b
commit
d359a7aefb
@ -626,7 +626,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
|||||||
g.go_stmt(it)
|
g.go_stmt(it)
|
||||||
}
|
}
|
||||||
ast.GotoLabel {
|
ast.GotoLabel {
|
||||||
g.writeln('$it.name:')
|
g.writeln('$it.name: {}')
|
||||||
}
|
}
|
||||||
ast.GotoStmt {
|
ast.GotoStmt {
|
||||||
g.writeln('goto $it.name;')
|
g.writeln('goto $it.name;')
|
||||||
|
10
vlib/v/tests/goto_test.v
Normal file
10
vlib/v/tests/goto_test.v
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fn test_goto() {
|
||||||
|
mut i := 0
|
||||||
|
a: b := 1
|
||||||
|
_ = b
|
||||||
|
i++
|
||||||
|
if i < 3 {
|
||||||
|
goto a
|
||||||
|
}
|
||||||
|
assert i == 3
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user