Skip to content

Commit

Permalink
fixes #13708
Browse files Browse the repository at this point in the history
  • Loading branch information
cooldome committed Mar 20, 2020
1 parent b6e04ea commit 461698d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/spawn.nim
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ proc addLocalVar(g: ModuleGraph; varSection, varInit: PNode; owner: PSym; typ: P
vpart[2] = if varInit.isNil: v else: vpart[1]
varSection.add vpart
if varInit != nil:
if useShallowCopy and typeNeedsNoDeepCopy(typ) or optTinyRtti in g.config.globalOptions:
if typ.attachedOps[attachedAsgn] != nil:
var call = newNode(nkCall)
call.add newSymNode(typ.attachedOps[attachedAsgn])
call.add genAddrOf(newSymNode(result))
call.add v
varInit.add call
elif useShallowCopy and typeNeedsNoDeepCopy(typ) or optTinyRtti in g.config.globalOptions:
varInit.add newFastAsgnStmt(newSymNode(result), v)
else:
let deepCopyCall = newNodeI(nkCall, varInit.info, 3)
Expand Down

0 comments on commit 461698d

Please sign in to comment.