topttree destructor finally works

This commit is contained in:
Araq 2017-10-24 09:58:07 +02:00
commit 4f2b79a380
5 changed files with 16 additions and 60 deletions

View file

@ -664,19 +664,6 @@ proc afterCallActions(c: PContext; n, orig: PNode, flags: TExprFlags): PNode =
of skMacro: result = semMacroExpr(c, result, orig, callee, flags)
of skTemplate: result = semTemplateExpr(c, result, callee, flags)
else:
when false:
if callee.name.s[0] == '=' and result.len > 1:
# careful, do not skip tyDistinct here:
let t = result[1].typ.skipTypes({tyVar, tyGenericInst, tyAlias, tyInferred})
proc patchHead(callee: PSym; name: string; field: PSym; result: PNode) =
if callee.name.s == name and field != nil:
result.sons[0].sym = field
patchHead(callee, "=destroy", t.destructor, result)
patchHead(callee, "=sink", t.sink, result)
patchHead(callee, "=", t.assignment, result)
semFinishOperands(c, result)
activate(c, result)
fixAbstractType(c, result)