introduce nkTupleConstr AST node for unary tuple construction; breaking change
This commit is contained in:
parent
ab426faa22
commit
47335aab41
26 changed files with 91 additions and 56 deletions
|
|
@ -437,6 +437,9 @@ proc lsub(g: TSrcGen; n: PNode): int =
|
|||
of nkCommand: result = lsub(g, n.sons[0]) + lcomma(g, n, 1) + 1
|
||||
of nkExprEqExpr, nkAsgn, nkFastAsgn: result = lsons(g, n) + 3
|
||||
of nkPar, nkCurly, nkBracket, nkClosure: result = lcomma(g, n) + 2
|
||||
of nkTupleConstr:
|
||||
# assume the trailing comma:
|
||||
result = lcomma(g, n) + 3
|
||||
of nkArgList: result = lcomma(g, n)
|
||||
of nkTableConstr:
|
||||
result = if n.len > 0: lcomma(g, n) + 2 else: len("{:}")
|
||||
|
|
@ -1007,6 +1010,11 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
|
|||
put(g, tkParLe, "(")
|
||||
gcomma(g, n, c)
|
||||
put(g, tkParRi, ")")
|
||||
of nkTupleConstr:
|
||||
put(g, tkParLe, "(")
|
||||
gcomma(g, n, c)
|
||||
if n.len == 1: put(g, tkComma, ",")
|
||||
put(g, tkParRi, ")")
|
||||
of nkCurly:
|
||||
put(g, tkCurlyLe, "{")
|
||||
gcomma(g, n, c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue