tuple unpacking works in a non-var/let context
This commit is contained in:
parent
2733c508ef
commit
bfd2fd67f9
5 changed files with 69 additions and 2 deletions
|
|
@ -1282,6 +1282,14 @@ proc semAsgn(c: PContext, n: PNode): PNode =
|
|||
result = buildOverloadedSubscripts(n.sons[0], getIdent"{}=")
|
||||
add(result, n[1])
|
||||
return semExprNoType(c, result)
|
||||
of nkPar:
|
||||
if a.len >= 2:
|
||||
# unfortunately we need to rewrite ``(x, y) = foo()`` already here so
|
||||
# that overloading of the assignment operator still works. Usually we
|
||||
# prefer to do these rewritings in transf.nim:
|
||||
return semStmt(c, lowerTupleUnpackingForAsgn(n, c.p.owner))
|
||||
else:
|
||||
a = semExprWithType(c, a, {efLValue})
|
||||
else:
|
||||
a = semExprWithType(c, a, {efLValue})
|
||||
n.sons[0] = a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue