bugfix: empty object case branches produce an error

This commit is contained in:
Araq
2011-06-19 16:13:31 +02:00
parent 898e5c3d2c
commit d608e4d115
2 changed files with 5 additions and 2 deletions

View File

@@ -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

View File

@@ -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...