some gc:destructors progress

This commit is contained in:
Andreas Rumpf
2019-09-16 13:54:29 +02:00
parent 6c487a6309
commit 2a59f499e9
2 changed files with 1 additions and 15 deletions

View File

@@ -142,7 +142,7 @@ proc instantiateGeneric(c: var TLiftCtx; op: PSym; t, typeInst: PType): PSym =
proc considerAsgnOrSink(c: var TLiftCtx; t: PType; body, x, y: PNode;
field: var PSym): bool =
if optNimV2 in c.g.config.globalOptions:
if c.g.config.selectedGC == gcDestructors:
let op = field
if field != nil and sfOverriden in field.flags:
if sfError in op.flags:

View File

@@ -617,20 +617,6 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType =
eraseVoidParams(result)
skipIntLiteralParams(result)
of tySequence:
if cl.isReturnType and cl.c.config.selectedGC == gcDestructors and
result.attachedOps[attachedDestructor].isNil and
result[0].kind != tyEmpty and optNimV2 notin cl.c.config.globalOptions:
let s = cl.c.graph.sysTypes[tySequence]
var old = copyType(s, s.owner, keepId=false)
# Remove the 'T' parameter from tySequence:
old.sons.setLen 0
old.n = nil
old.flags = {tfHasAsgn}
old.addSonSkipIntLit result[0]
result.attachedOps = old.attachedOps
cl.c.typesWithOps.add((result, old))
else: discard
else:
# If this type doesn't refer to a generic type we may still want to run it