Fix loop tuple unpacking in templates (#11174)
* Fix loop tuple unpacking in templates * Add test
This commit is contained in:
parent
094d71cb6f
commit
e42c304e4a
2 changed files with 14 additions and 1 deletions
|
|
@ -372,7 +372,11 @@ proc semTemplBody(c: var TemplCtx, n: PNode): PNode =
|
|||
openScope(c)
|
||||
n.sons[L-2] = semTemplBody(c, n.sons[L-2])
|
||||
for i in countup(0, L - 3):
|
||||
addLocalDecl(c, n.sons[i], skForVar)
|
||||
if n[i].kind == nkVarTuple:
|
||||
for j in 0 ..< sonsLen(n[i])-1:
|
||||
addLocalDecl(c, n[i][j], skForVar)
|
||||
else:
|
||||
addLocalDecl(c, n.sons[i], skForVar)
|
||||
openScope(c)
|
||||
n.sons[L-1] = semTemplBody(c, n.sons[L-1])
|
||||
closeScope(c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue