codegen improvement: map the empty string to 'nil' since it's now allowed to do that
This commit is contained in:
parent
05121d84b3
commit
640b30a47f
1 changed files with 3 additions and 3 deletions
|
|
@ -65,8 +65,8 @@ proc genLiteral(p: BProc, n: PNode, ty: PType): Rope =
|
||||||
of tyString:
|
of tyString:
|
||||||
# with the new semantics for 'nil' strings, we can map "" to nil and
|
# with the new semantics for 'nil' strings, we can map "" to nil and
|
||||||
# save tons of allocations:
|
# save tons of allocations:
|
||||||
#if n.strVal.len == 0: result = genNilStringLiteral(p.module, n.info)
|
if n.strVal.len == 0: result = genNilStringLiteral(p.module, n.info)
|
||||||
#else:
|
else:
|
||||||
result = genStringLiteral(p.module, n)
|
result = genStringLiteral(p.module, n)
|
||||||
else:
|
else:
|
||||||
if n.strVal.isNil: result = rope("NIM_NIL")
|
if n.strVal.isNil: result = rope("NIM_NIL")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue