diff options
author | Neelesh Chandola <neelesh.chandola@outlook.com> | 2019-01-10 17:19:35 +0530 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-01-10 12:49:35 +0100 |
commit | d998cb58dd9a29cb7b739ee4daa6a0528810790d (patch) | |
tree | 7d18418f23f1ef1c57dd69bea778226664fa9e49 /compiler/jsgen.nim | |
parent | 6389271d1cef23e2f810736a4fb0c06d0164d984 (diff) | |
download | Nim-d998cb58dd9a29cb7b739ee4daa6a0528810790d.tar.gz |
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
Diffstat (limited to 'compiler/jsgen.nim')
-rw-r--r-- | compiler/jsgen.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 83d205bc2..2f5e202e0 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -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)]) |