From a04c9d1f6215a52c89e1e641ea2afcf4ce2a90de Mon Sep 17 00:00:00 2001 From: flywind Date: Wed, 3 Mar 2021 08:08:52 +0800 Subject: rename prepareStrMutation to prepareMutation (#17235) * remove unnecessary when statement * remove outdated codes * rename prepareStrMutation to prepareMutation --- doc/destructors.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/destructors.rst b/doc/destructors.rst index 3c50241eb..ff6ceaf5e 100644 --- a/doc/destructors.rst +++ b/doc/destructors.rst @@ -676,25 +676,25 @@ moveMem(addr y[0], addr x[0], 3) ``` The program fails because we need to prepare a fresh copy for the variable `y`. -`prepareStrMutation` should be called before the address operation. +`prepareMutation` should be called before the address operation. ```nim var x = "abc" var y = x -prepareStrMutation(y) +prepareMutation(y) moveMem(addr y[0], addr x[0], 3) assert y == "abc" ``` -Now `prepareStrMutation` solves the problem. +Now `prepareMutation` solves the problem. It manually creates a fresh copy and makes the variable `y` mutable. ```nim var x = "abc" var y = x -prepareStrMutation(y) +prepareMutation(y) moveMem(addr y[0], addr x[0], 3) moveMem(addr y[0], addr x[0], 3) moveMem(addr y[0], addr x[0], 3) -- cgit 1.4.1-2-gfad0