when expressions, proper rendering for nkDo and nkLambda and parser support for x.type and x.addr

This commit is contained in:
Zahary Karadjov 2012-04-05 22:43:37 +03:00
commit 98b7bdaa50
6 changed files with 55 additions and 19 deletions

View file

@ -25,13 +25,13 @@ proc semWhen(c: PContext, n: PNode, semCheck = true): PNode =
for i in countup(0, sonsLen(n) - 1):
var it = n.sons[i]
case it.kind
of nkElifBranch:
of nkElifBranch, nkElifExpr:
checkSonsLen(it, 2)
var e = semAndEvalConstExpr(c, it.sons[0])
if e.kind != nkIntLit: InternalError(n.info, "semWhen")
if e.intVal != 0 and result == nil:
setResult(it.sons[1])
of nkElse:
of nkElse, nkElseExpr:
checkSonsLen(it, 1)
if result == nil:
setResult(it.sons[0])