From f5114ee4e17390510decef433841e0ec78105685 Mon Sep 17 00:00:00 2001 From: xflywind <43030857+ringabout@users.noreply.github.com> Date: Mon, 29 Aug 2022 20:24:41 +0800 Subject: [PATCH] replace shallowCopy with move for ARC/ORC --- karax/vdom.nim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/karax/vdom.nim b/karax/vdom.nim index 7a9ba69..1651c99 100644 --- a/karax/vdom.nim +++ b/karax/vdom.nim @@ -255,11 +255,17 @@ proc getAttr*(n: VNode; key: kstring): kstring = if n.attrs[i] == key: return n.attrs[i+1] proc takeOverAttr*(newNode, oldNode: VNode) = - shallowCopy oldNode.attrs, newNode.attrs + when defined(gcArc) or defined(gcOrc): + oldNode.attrs = move newNode.attrs + else: + shallowCopy oldNode.attrs, newNode.attrs proc takeOverFields*(newNode, oldNode: VNode) = template take(field) = - shallowCopy oldNode.field, newNode.field + when defined(gcArc) or defined(gcOrc): + oldNode.field = move newNode.field + else: + shallowCopy oldNode.field, newNode.field take kind take index take id