WIP: disallow 'nil' for strings and seqs

This commit is contained in:
Andreas Rumpf 2018-08-13 11:41:33 +02:00
commit dae5450947
43 changed files with 207 additions and 173 deletions

View file

@ -65,7 +65,8 @@ proc genLiteral(p: BProc, n: PNode, ty: PType): Rope =
of tyString:
# with the new semantics for 'nil' strings, we can map "" to nil and
# save tons of allocations:
if n.strVal.len == 0: result = genNilStringLiteral(p.module, n.info)
if n.strVal.len == 0 and optNilSeqs notin p.options:
result = genNilStringLiteral(p.module, n.info)
else:
result = genStringLiteral(p.module, n)
else: