summary refs log tree commit diff stats
path: root/compiler/nimfix/prettybase.nim
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-07-26 22:51:01 +0800
committerGitHub <noreply@github.com>2022-07-26 16:51:01 +0200
commit4c46358db1c11b7c4772431ad5e158ab00a7f4fc (patch)
tree1eea5f2514f2eb545e909616dda842001248f44d /compiler/nimfix/prettybase.nim
parent1c39af3389b2251eb93b2f8e77911078cb7d5679 (diff)
downloadNim-4c46358db1c11b7c4772431ad5e158ab00a7f4fc.tar.gz
remove shallowCopy for ARC/ORC (#20070)
* remove shallowCopy for ARC/ORC

* use move

* fix

* more fixes

* typo

* Update lib/system.nim

* follow

* add nodestroy

* move

* copy string

* add a changelog entry

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'compiler/nimfix/prettybase.nim')
-rw-r--r--compiler/nimfix/prettybase.nim10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/nimfix/prettybase.nim b/compiler/nimfix/prettybase.nim
index fbc2e3bd1..78c24bae3 100644
--- a/compiler/nimfix/prettybase.nim
+++ b/compiler/nimfix/prettybase.nim
@@ -22,7 +22,10 @@ proc replaceDeprecated*(conf: ConfigRef; info: TLineInfo; oldSym, newSym: PIdent
   let last = first+identLen(line, first)-1
   if cmpIgnoreStyle(line[first..last], oldSym.s) == 0:
     var x = line.substr(0, first-1) & newSym.s & line.substr(last+1)
-    system.shallowCopy(conf.m.fileInfos[info.fileIndex.int32].lines[info.line.int-1], x)
+    when defined(gcArc) or defined(gcOrc):
+      conf.m.fileInfos[info.fileIndex.int32].lines[info.line.int-1] = move x
+    else:
+      system.shallowCopy(conf.m.fileInfos[info.fileIndex.int32].lines[info.line.int-1], x)
     conf.m.fileInfos[info.fileIndex.int32].dirty = true
     #if newSym.s == "File": writeStackTrace()
 
@@ -35,5 +38,8 @@ proc replaceComment*(conf: ConfigRef; info: TLineInfo) =
   if line[first] != '#': inc first
 
   var x = line.substr(0, first-1) & "discard " & line.substr(first+1).escape
-  system.shallowCopy(conf.m.fileInfos[info.fileIndex.int32].lines[info.line.int-1], x)
+  when defined(gcArc) or defined(gcOrc):
+    conf.m.fileInfos[info.fileIndex.int32].lines[info.line.int-1] = move x
+  else:
+    system.shallowCopy(conf.m.fileInfos[info.fileIndex.int32].lines[info.line.int-1], x)
   conf.m.fileInfos[info.fileIndex.int32].dirty = true