mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
* Rewrite genTryCpp * correction * Implement polymorphic raise in cpp * revert backticks in emit * Cleanp a comment * revert test changes * better handling of <new> header
42 lines
512 B
Nim
42 lines
512 B
Nim
discard """
|
|
targets: "c cpp"
|
|
file: "tnestedreturn.nim"
|
|
output: "A\nB\nC\n"
|
|
"""
|
|
|
|
# Various tests of return nested in double try/except statements
|
|
|
|
proc test1() =
|
|
|
|
defer: echo "A"
|
|
|
|
try:
|
|
raise newException(OSError, "Problem")
|
|
except OSError:
|
|
return
|
|
|
|
test1()
|
|
|
|
|
|
proc test2() =
|
|
|
|
defer: echo "B"
|
|
|
|
try:
|
|
return
|
|
except OSError:
|
|
discard
|
|
|
|
test2()
|
|
|
|
proc test3() =
|
|
try:
|
|
try:
|
|
raise newException(OSError, "Problem")
|
|
except OSError:
|
|
return
|
|
finally:
|
|
echo "C"
|
|
|
|
test3()
|