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

cmd/tools/vast: update DeferStmt (#10291)

This commit is contained in:
lydiandy
2021-06-01 03:49:16 +08:00
committed by GitHub
parent 90292ce981
commit 67518f946b
2 changed files with 15 additions and 1 deletions

View File

@@ -97,6 +97,17 @@ fn add(x int, y int) int {
return x + y
}
// function with defer stmt
fn defer_fn() {
mut x := 1
println('start fn')
defer {
println('in defer block')
println(x)
}
println('end fn')
}
// generic function
fn g_fn<T>(p T) T {
return p