1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: add support for goto

This commit is contained in:
Alexey 2020-03-02 19:41:32 +03:00 committed by GitHub
parent c6107276df
commit 78c885d657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -195,6 +195,12 @@ fn (f mut Fmt) stmt(node ast.Stmt) {
f.stmts(it.stmts)
f.writeln('}')
}
ast.GotoLabel {
f.writeln('$it.name:')
}
ast.GotoStmt {
f.writeln('goto $it.name')
}
ast.LineComment {
f.writeln('// $it.text')
}

View File

@ -3,9 +3,11 @@ fn hello() {
a = 10
a++
-23
goto lbl
b := 42
println('hello')
abc()
lbl:
if true {
a = 10
a++

View File

@ -4,9 +4,11 @@ fn hello()
a = 10
a++
-23
goto lbl
b:= 42
println( 'hello' )
abc()
lbl:
if true {
a = 10
a++