diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2020-11-14 19:51:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-14 12:51:23 +0100 |
commit | 47ce24f680dbf5aed8cd393f011739ea5d7a9928 (patch) | |
tree | 85d542b7e08c3e1296d52b082efd1cad57185d5f /compiler/jsgen.nim | |
parent | 784720a7efc5c2b722be51c26a06ade0f4f11aaa (diff) | |
download | Nim-47ce24f680dbf5aed8cd393f011739ea5d7a9928.tar.gz |
fix #12303 (#15964)
Diffstat (limited to 'compiler/jsgen.nim')
-rw-r--r-- | compiler/jsgen.nim | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 34ebd306a..3a1ef7fbb 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -1074,8 +1074,13 @@ proc genAsgnAux(p: PProc, x, y: PNode, noCopyNeeded: bool) = lineF(p, "$1 = $2;$n", [a.rdLoc, b.rdLoc]) else: useMagic(p, "nimCopy") - lineF(p, "nimCopy($1, $2, $3);$n", - [a.res, b.res, genTypeInfo(p, y.typ)]) + # supports proc getF(): var T + if x.kind in {nkHiddenDeref, nkDerefExpr} and x[0].kind in nkCallKinds: + lineF(p, "nimCopy($1, $2, $3);$n", + [a.res, b.res, genTypeInfo(p, y.typ)]) + else: + lineF(p, "$1 = nimCopy($1, $2, $3);$n", + [a.res, b.res, genTypeInfo(p, y.typ)]) of etyBaseIndex: if a.typ != etyBaseIndex or b.typ != etyBaseIndex: if y.kind == nkCall: |