void object fields are now ignored by codegen and fields/fieldPairs iterator (#10144)

* Codegen now ignores object fields of type void
* Fix `$` bug for objects/tuples where it does not add a comma
* fields/fieldPairs iterators now ignore void types
* Use `isEmptyType` instead of checking for `tyVoid` directly
This commit is contained in:
Neelesh Chandola 2019-01-10 17:19:35 +05:30 • committed by Andreas Rumpf
commit d998cb58dd
5 changed files with 25 additions and 0 deletions

View file

@ -1502,6 +1502,8 @@ proc createRecordVarAux(p: PProc, rec: PNode, excludedFieldIDs: IntSet, output:
for i in countup(1, sonsLen(rec) - 1):
createRecordVarAux(p, lastSon(rec.sons[i]), excludedFieldIDs, output)
of nkSym:
# Do not produce code for void types
if isEmptyType(rec.sym.typ): return
if rec.sym.id notin excludedFieldIDs:
if output.len > 0: output.add(", ")
output.addf("$#: ", [mangleName(p.module, rec.sym)])