mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
allow multiple defers
This commit is contained in:
parent
5d188130e5
commit
ac238a5362
@ -3439,7 +3439,7 @@ fn (p mut Parser) defer_st() {
|
||||
p.check(.lcbr)
|
||||
p.genln('{')
|
||||
p.statements()
|
||||
p.cur_fn.defer_text = p.cgen.lines.right(pos).join('\n')
|
||||
p.cur_fn.defer_text = p.cgen.lines.right(pos).join('\n') + p.cur_fn.defer_text
|
||||
p.genln('*/')
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ fn foo() string {
|
||||
fn foo2() string {
|
||||
println('start')
|
||||
defer { println('defer') }
|
||||
defer { println('defer2') }
|
||||
println('end')
|
||||
return foo()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user