new destroyer pass works with procs too

This commit is contained in:
Andreas Rumpf
2017-10-13 07:00:52 +02:00
parent ffe52a7f7b
commit 5dca695bcf
4 changed files with 11 additions and 9 deletions

View File

@@ -78,11 +78,11 @@ proc create*(lit: string): mystring =
copyMem(addr result.data[result.len], unsafeAddr lit[0], newLen + 1)
result.len = newLen
func `&`*(a, b: mystring): mystring =
proc `&`*(a, b: mystring): mystring =
result = a
result.add b
func main(n: int) =
proc main(n: int) =
var a: mystring
let b = create" to append"
for i in 0..<n:
@@ -92,6 +92,5 @@ func main(n: int) =
a.add c
echo cstring(a.data)
main(1000)
echo "after ", allocCount, " ", deallocCount