introduce nkTupleConstr AST node for unary tuple construction; breaking change

This commit is contained in:
Andreas Rumpf 2018-04-13 17:06:46 +02:00
commit 47335aab41
26 changed files with 91 additions and 56 deletions

View file

@ -2226,7 +2226,7 @@ proc expr(p: BProc, n: PNode, d: var TLoc) =
genSeqConstr(p, n, d)
else:
genArrayConstr(p, n, d)
of nkPar:
of nkPar, nkTupleConstr:
if isDeepConstExpr(n) and n.len != 0:
exprComplexConst(p, n, d)
else:
@ -2458,7 +2458,7 @@ proc genConstExpr(p: BProc, n: PNode): Rope =
var cs: TBitSet
toBitSet(n, cs)
result = genRawSetData(cs, int(getSize(n.typ)))
of nkBracket, nkPar, nkClosure:
of nkBracket, nkPar, nkTupleConstr, nkClosure:
var t = skipTypes(n.typ, abstractInst)
if t.kind == tySequence:
result = genConstSeq(p, n, n.typ)