summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@gmail.com>2017-02-06 19:02:51 +0100
committerDominik Picheta <dominikpicheta@gmail.com>2017-02-06 19:02:51 +0100
commit4661ae22dd87727900eb7e106957afce2047e284 (patch)
treee15078586e18e3f2cf7cc69a66dc84511a5048f3 /compiler
parent1c233ba27a17830e325822fc27a12074eef49ccb (diff)
downloadNim-4661ae22dd87727900eb7e106957afce2047e284.tar.gz
Fixes incorrect scoping in semstmts.semTry.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semstmts.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 9752ccac1..25d4b3c74 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -274,7 +274,7 @@ proc semTry(c: PContext, n: PNode): PNode =
     var a = n.sons[i]
     checkMinSonsLen(a, 1)
     var length = sonsLen(a)
-
+    openScope(c)
     if a.kind == nkExceptBranch:
       # so that ``except [a, b, c]`` is supported:
       if length == 2 and a.sons[0].kind == nkBracket:
@@ -319,6 +319,7 @@ proc semTry(c: PContext, n: PNode): PNode =
     a.sons[length-1] = semExprBranchScope(c, a.sons[length-1])
     if a.kind != nkFinally: typ = commonType(typ, a.sons[length-1].typ)
     else: dec last
+    closeScope(c)
 
   dec c.p.inTryStmt
   if isEmptyType(typ) or typ.kind == tyNil: