2019-07-21 00:49:34 +02:00
|
|
|
fn foo() string {
|
|
|
|
println('foo()')
|
|
|
|
return 'foo'
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo2() string {
|
|
|
|
println('start')
|
|
|
|
defer { println('defer') }
|
2019-07-21 16:34:21 +02:00
|
|
|
defer { println('defer2') }
|
2019-07-21 00:49:34 +02:00
|
|
|
println('end')
|
|
|
|
return foo()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test_defer() {
|
|
|
|
assert foo2() == 'foo'
|
|
|
|
}
|