allow multiple defers
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