diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-07-21 13:16:53 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-07-21 13:16:53 +0200 |
commit | f485ebe1624656c0cf495baaebc5d45fdc9bdbeb (patch) | |
tree | 5c462e7836f027fc7371d6f589d3cb1b73b2bbed /compiler/cgen.nim | |
parent | 4389409e2657e4cec098180299b2d41b1a3a40f7 (diff) | |
download | Nim-f485ebe1624656c0cf495baaebc5d45fdc9bdbeb.tar.gz |
--gc:destructors: next steps; WIP
Diffstat (limited to 'compiler/cgen.nim')
-rw-r--r-- | compiler/cgen.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 8d8fdfcd9..80c03f9e4 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -334,7 +334,9 @@ proc resetLoc(p: BProc, loc: var TLoc) = proc constructLoc(p: BProc, loc: TLoc, isTemp = false) = let typ = loc.t - if not isComplexValueType(typ): + if p.config.selectedGc == gcDestructors and skipTypes(typ, abstractInst).kind in {tyString, tySequence}: + linefmt(p, cpsStmts, "$1.len = 0; $1.p = NIM_NIL;$n", rdLoc(loc)) + elif not isComplexValueType(typ): linefmt(p, cpsStmts, "$1 = ($2)0;$n", rdLoc(loc), getTypeDesc(p.module, typ)) else: |