bugfix: finally sections are executed before return/break

This commit is contained in:
Araq 2010-09-20 22:33:23 +02:00
commit 0a57f662fa
7 changed files with 71 additions and 49 deletions

View file

@ -19,7 +19,9 @@ tconstr2.nim;69
tcopy.nim;TEMP=C:\Programs\xyz\bin
tcurrncy.nim;25
texplicitgeneric1.nim;Key: 12 value: 12Key: 13 value: 13 Key: A value: 12 Key: B value: 13
tfinally.nim;came here
tfinally.nim;came here 3
tfinally2.nim;ABCD
tfinally3.nim;false
tfloat1.nim;Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow]
tfloat2.nim;Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp]
tformat.nim;Hi Andreas! How do you feel, Rumpf?

1 tack.nim 125
19 tcopy.nim TEMP=C:\Programs\xyz\bin
20 tcurrncy.nim 25
21 texplicitgeneric1.nim Key: 12 value: 12Key: 13 value: 13 Key: A value: 12 Key: B value: 13
22 tfinally.nim came here came here 3
23 tfinally2.nim ABCD
24 tfinally3.nim false
25 tfloat1.nim Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow]
26 tfloat2.nim Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp]
27 tformat.nim Hi Andreas! How do you feel, Rumpf?

View file

@ -2,9 +2,14 @@
proc main: int =
try:
return 1
try:
return 1
finally:
stdout.write("came ")
return 2
finally:
echo "came here"
stdout.write("here ")
return 3
discard main() #OUT came here
echo main() #OUT came here 1