diff options
author | Araq <rumpf_a@web.de> | 2013-01-08 08:11:21 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-01-08 08:11:21 +0100 |
commit | 1bc5ff6dc912d3bfdd7dbbed88d06bce18804db3 (patch) | |
tree | 214c3e0ce6056334f7fe6185aa15978a65cef189 | |
parent | 3c73654acaff5aef6f5ca60facf2bf43c00a4e36 (diff) | |
download | Nim-1bc5ff6dc912d3bfdd7dbbed88d06bce18804db3.tar.gz |
fixes #292
-rw-r--r-- | compiler/sempass2.nim | 9 | ||||
-rw-r--r-- | tests/compile/teffects1.nim | 17 |
2 files changed, 23 insertions, 3 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index bd8a3ba02..b2fd0fb04 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2012 Andreas Rumpf +# (c) Copyright 2013 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -146,8 +146,11 @@ proc catches(tracked: PEffects, e: PType) = dec L else: inc i - setLen(tracked.exc.sons, L) - + if not isNil(tracked.exc.sons): + setLen(tracked.exc.sons, L) + else: + assert L == 0 + proc catchesAll(tracked: PEffects) = if not isNil(tracked.exc.sons): setLen(tracked.exc.sons, tracked.bottom) diff --git a/tests/compile/teffects1.nim b/tests/compile/teffects1.nim new file mode 100644 index 000000000..49af28469 --- /dev/null +++ b/tests/compile/teffects1.nim @@ -0,0 +1,17 @@ + +type + PMenu = ref object + PMenuItem = ref object + +proc createMenuItem*(menu: PMenu, label: string, + action: proc (i: PMenuItem, p: pointer) {.cdecl.}) = nil + +var s: PMenu +createMenuItem(s, "Go to definition...", + proc (i: PMenuItem, p: pointer) {.cdecl.} = + try: + echo(i.repr) + except EInvalidValue: + echo("blah") +) + |