summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-06-19 16:13:31 +0200
committerAraq <rumpf_a@web.de>2011-06-19 16:13:31 +0200
commitd608e4d11589c7edcace93b731984b67cb26e2d1 (patch)
tree5c4155eef8da31abe1c4dfdb5e7c8c227af89cce
parent898e5c3d2c060b7f7b320a7ee7c602c872a06c1f (diff)
downloadNim-d608e4d11589c7edcace93b731984b67cb26e2d1.tar.gz
bugfix: empty object case branches produce an error
-rwxr-xr-xcompiler/parser.nim6
-rwxr-xr-xtodo.txt1
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim
index 4b7ba97ad..677aa57ba 100755
--- a/compiler/parser.nim
+++ b/compiler/parser.nim
@@ -1177,7 +1177,11 @@ proc parseObjectCase(p: var TParser): PNode =
       eat(p, tkColon)
     else: break 
     skipComment(p, b)
-    addSon(b, parseObjectPart(p))
+    var fields = parseObjectPart(p)
+    if fields.kind == nkEmpty:
+      parMessage(p, errIdentifierExpected, p.tok)
+      fields = newNodeP(nkNilLit, p) # don't break further semantic checking
+    addSon(b, fields)
     addSon(result, b)
     if b.kind == nkElse: break 
   
diff --git a/todo.txt b/todo.txt
index 1dd27d655..2ccd48652 100755
--- a/todo.txt
+++ b/todo.txt
@@ -23,7 +23,6 @@ version 0.9.0
 
 Bugs
 ----
-- the parser allows empty object case branches
 - bug: generic assign still buggy
   - Optimization: If we use a temporary for the result anyway the code gen
     should make use of this fact to generate better code...