From d608e4d11589c7edcace93b731984b67cb26e2d1 Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 19 Jun 2011 16:13:31 +0200 Subject: [PATCH] bugfix: empty object case branches produce an error --- compiler/parser.nim | 6 +++++- todo.txt | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/parser.nim b/compiler/parser.nim index 4b7ba97adb..677aa57ba2 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 1dd27d655a..2ccd486521 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...