fixes compiler regression
This commit is contained in:
parent
6e6a9a721f
commit
f1ee36692a
1 changed files with 4 additions and 1 deletions
|
|
@ -74,6 +74,7 @@ proc liftBodyObj(c: var TLiftCtx; n, body, x, y: PNode) =
|
||||||
# generate selector:
|
# generate selector:
|
||||||
var access = dotField(x, n[0].sym)
|
var access = dotField(x, n[0].sym)
|
||||||
caseStmt.add(access)
|
caseStmt.add(access)
|
||||||
|
var emptyBranches = 0
|
||||||
# copy the branches over, but replace the fields with the for loop body:
|
# copy the branches over, but replace the fields with the for loop body:
|
||||||
for i in 1 ..< n.len:
|
for i in 1 ..< n.len:
|
||||||
var branch = copyTree(n[i])
|
var branch = copyTree(n[i])
|
||||||
|
|
@ -81,7 +82,9 @@ proc liftBodyObj(c: var TLiftCtx; n, body, x, y: PNode) =
|
||||||
branch.sons[L-1] = newNodeI(nkStmtList, c.info)
|
branch.sons[L-1] = newNodeI(nkStmtList, c.info)
|
||||||
|
|
||||||
liftBodyObj(c, n[i].lastSon, branch.sons[L-1], x, y)
|
liftBodyObj(c, n[i].lastSon, branch.sons[L-1], x, y)
|
||||||
|
if branch.sons[L-1].len == 0: inc emptyBranches
|
||||||
caseStmt.add(branch)
|
caseStmt.add(branch)
|
||||||
|
if emptyBranches != n.len-1:
|
||||||
body.add(caseStmt)
|
body.add(caseStmt)
|
||||||
of nkRecList:
|
of nkRecList:
|
||||||
for t in items(n): liftBodyObj(c, t, body, x, y)
|
for t in items(n): liftBodyObj(c, t, body, x, y)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue