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

@ -19,6 +19,9 @@ type
c: PContext
proc instFieldLoopBody(c: TFieldInstCtx, n: PNode, forLoop: PNode): PNode =
if c.field != nil and isEmptyType(c.field.typ):
result = newNode(nkEmpty)
return
case n.kind
of nkEmpty..pred(nkIdent), succ(nkSym)..nkNilLit: result = n
of nkIdent, nkSym: