Fix defer not not-working at top level (#10191)
This commit is contained in:
parent
15773c455a
commit
e77dd683eb
4 changed files with 4 additions and 13 deletions
|
|
@ -1,6 +1,5 @@
|
|||
discard """
|
||||
output: '''hi
|
||||
hi
|
||||
1
|
||||
hi
|
||||
2
|
||||
|
|
@ -10,13 +9,6 @@ A'''
|
|||
|
||||
# bug #1742
|
||||
|
||||
template test(): untyped =
|
||||
let a = 0
|
||||
defer: echo "hi"
|
||||
a
|
||||
|
||||
let i = test()
|
||||
|
||||
import strutils
|
||||
let x = try: parseInt("133a")
|
||||
except: -1
|
||||
|
|
@ -31,7 +23,7 @@ template atFuncEnd =
|
|||
|
||||
template testB(): untyped =
|
||||
let a = 0
|
||||
defer: echo "hi" # Delete this line to make it work
|
||||
defer: echo "hi"
|
||||
a
|
||||
|
||||
proc main =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue