mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-15 07:43:26 +00:00
codegen improvement: map the empty string to 'nil' since it's now allowed to do that
This commit is contained in:
@@ -65,9 +65,9 @@ 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)
|
||||
#else:
|
||||
result = genStringLiteral(p.module, n)
|
||||
if n.strVal.len == 0: result = genNilStringLiteral(p.module, n.info)
|
||||
else:
|
||||
result = genStringLiteral(p.module, n)
|
||||
else:
|
||||
if n.strVal.isNil: result = rope("NIM_NIL")
|
||||
else: result = makeCString(n.strVal)
|
||||
|
||||
Reference in New Issue
Block a user