mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
fix for defer detect
This commit is contained in:
parent
acdd49c40f
commit
14a1b59dc8
1 changed files with 3 additions and 0 deletions
|
@ -35,9 +35,12 @@ fn (mut c Checker) return_stmt(mut node ast.Return) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check `defer_stmts` in return, to ensure the same behavior with `cgen`
|
// check `defer_stmts` in return, to ensure the same behavior with `cgen`
|
||||||
|
old_inside_defer := c.inside_defer
|
||||||
|
c.inside_defer = true
|
||||||
for i := c.table.cur_fn.defer_stmts.len - 1; i >= 0; i-- {
|
for i := c.table.cur_fn.defer_stmts.len - 1; i >= 0; i-- {
|
||||||
c.stmts(mut c.table.cur_fn.defer_stmts[i].stmts)
|
c.stmts(mut c.table.cur_fn.defer_stmts[i].stmts)
|
||||||
}
|
}
|
||||||
|
c.inside_defer = old_inside_defer
|
||||||
|
|
||||||
c.expected_type = c.table.cur_fn.return_type
|
c.expected_type = c.table.cur_fn.return_type
|
||||||
mut expected_type := c.unwrap_generic(c.expected_type)
|
mut expected_type := c.unwrap_generic(c.expected_type)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue