summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-10-07 10:07:18 -0700
committerAraq <rumpf_a@web.de>2011-10-07 10:07:18 -0700
commitfae8ea0cee55cf85a7d30d63d06c73ed3874fa89 (patch)
tree660df418fce1076c16cd7ab97574d0c6c12c6605 /compiler/semstmts.nim
parent130316751d88a93169304a19caf92308f115808c (diff)
parent4a444bf6dbf973faea020b1e82650e50eccf7d54 (diff)
downloadNim-fae8ea0cee55cf85a7d30d63d06c73ed3874fa89.tar.gz
Merge pull request #58 from zah/getast-unittests
getAst operational. Unit testing library based on it.
Diffstat (limited to 'compiler/semstmts.nim')
-rwxr-xr-xcompiler/semstmts.nim14
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index c00b68bb5..243c2ce00 100755
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -428,7 +428,7 @@ proc semRaise(c: PContext, n: PNode): PNode =
     var typ = n.sons[0].typ
     if typ.kind != tyRef or typ.sons[0].kind != tyObject: 
       localError(n.info, errExprCannotBeRaised)
-  
+
 proc semTry(c: PContext, n: PNode): PNode = 
   result = n
   checkMinSonsLen(n, 2)
@@ -438,15 +438,19 @@ proc semTry(c: PContext, n: PNode): PNode =
     var a = n.sons[i]
     checkMinSonsLen(a, 1)
     var length = sonsLen(a)
-    if a.kind == nkExceptBranch: 
-      for j in countup(0, length - 2): 
+    if a.kind == nkExceptBranch:
+      if length == 2 and a.sons[0].kind == nkBracket:
+        a.sons[0..0] = a.sons[0].sons
+        length = a.sonsLen
+
+      for j in countup(0, length - 2):
         var typ = semTypeNode(c, a.sons[j], nil)
         if typ.kind == tyRef: typ = typ.sons[0]
-        if typ.kind != tyObject: 
+        if typ.kind != tyObject:
           GlobalError(a.sons[j].info, errExprCannotBeRaised)
         a.sons[j] = newNodeI(nkType, a.sons[j].info)
         a.sons[j].typ = typ
-        if ContainsOrIncl(check, typ.id): 
+        if ContainsOrIncl(check, typ.id):
           localError(a.sons[j].info, errExceptionAlreadyHandled)
     elif a.kind != nkFinally: 
       illFormedAst(n)