first steps to the expr/stmt unification

This commit is contained in:
Araq 2013-04-30 02:38:49 +02:00
commit 2afadc5c9c
8 changed files with 159 additions and 92 deletions

View file

@ -231,8 +231,7 @@ proc genIfStmt(p: BProc, n: PNode) =
var Lend = getLabel(p)
for i in countup(0, sonsLen(n) - 1):
var it = n.sons[i]
case it.kind
of nkElifBranch:
if it.len == 2:
initLocExpr(p, it.sons[0], a)
Lelse = getLabel(p)
inc(p.labels)
@ -243,7 +242,7 @@ proc genIfStmt(p: BProc, n: PNode) =
if sonsLen(n) > 1:
lineFF(p, cpsStmts, "goto $1;$n", "br label %$1$n", [Lend])
fixLabel(p, Lelse)
of nkElse:
elif it.len == 1:
genSimpleBlock(p, it.sons[0])
else: internalError(n.info, "genIfStmt()")
if sonsLen(n) > 1: fixLabel(p, Lend)