summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgexprs.nim10
-rw-r--r--compiler/ccgstmts.nim8
-rw-r--r--compiler/ccgtrav.nim5
-rw-r--r--compiler/ccgtypes.nim2
-rw-r--r--compiler/cgen.nim2
-rw-r--r--compiler/commands.nim4
-rw-r--r--compiler/injectdestructors.nim2
-rw-r--r--compiler/lambdalifting.nim20
-rw-r--r--compiler/liftdestructors.nim6
-rw-r--r--compiler/options.nim6
-rw-r--r--compiler/scriptconfig.nim6
-rw-r--r--compiler/semexprs.nim2
-rw-r--r--compiler/semobjconstr.nim2
-rw-r--r--compiler/semstmts.nim6
-rw-r--r--compiler/semtypes.nim4
-rw-r--r--compiler/spawn.nim2
-rw-r--r--compiler/transf.nim2
17 files changed, 48 insertions, 41 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index 7a84fb1a2..13656acad 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -1206,7 +1206,7 @@ proc rawGenNew(p: BProc, a: TLoc, sizeExpr: Rope) =
   if sizeExpr.isNil:
     sizeExpr = "sizeof($1)" % [getTypeDesc(p.module, bt)]
 
-  if optNimV2 in p.config.globalOptions:
+  if optOwnedRefs in p.config.globalOptions:
     b.r = ropecg(p.module, "($1) #nimNewObj($2)",
         [getTypeDesc(p.module, typ), sizeExpr])
     genAssignment(p, a, b, {})
@@ -1484,7 +1484,7 @@ proc genNewFinalize(p: BProc, e: PNode) =
   gcUsage(p.config, e)
 
 proc genOfHelper(p: BProc; dest: PType; a: Rope; info: TLineInfo): Rope =
-  if optNimV2 in p.config.globalOptions:
+  if optTinyRtti in p.config.globalOptions:
     result = ropecg(p.module, "#isObj($1.m_type, $2)",
       [a, genTypeInfo2Name(p.module, dest)])
   else:
@@ -1535,7 +1535,7 @@ proc genOf(p: BProc, n: PNode, d: var TLoc) =
   genOf(p, n.sons[1], n.sons[2].typ, d)
 
 proc genRepr(p: BProc, e: PNode, d: var TLoc) =
-  if optNimV2 in p.config.globalOptions:
+  if optTinyRtti in p.config.globalOptions:
     localError(p.config, e.info, "'repr' is not available for --newruntime")
   var a: TLoc
   initLocExpr(p, e.sons[1], a)
@@ -2148,7 +2148,7 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
   of mCStrToStr: genDollar(p, e, d, "#cstrToNimstr($1)")
   of mStrToStr, mUnown: expr(p, e.sons[1], d)
   of mEnumToStr:
-    if optNimV2 in p.config.globalOptions:
+    if optTinyRtti in p.config.globalOptions:
       genEnumToStr(p, e, d)
     else:
       genRepr(p, e, d)
@@ -2423,7 +2423,7 @@ proc upConv(p: BProc, n: PNode, d: var TLoc) =
       while t.kind == tyObject and t.sons[0] != nil:
         add(r, ".Sup")
         t = skipTypes(t.sons[0], skipPtrs)
-    let checkFor = if optNimV2 in p.config.globalOptions:
+    let checkFor = if optTinyRtti in p.config.globalOptions:
                      genTypeInfo2Name(p.module, dest)
                    else:
                      genTypeInfo(p.module, dest, n.info)
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim
index 6ff7cf91c..fcef4a0ff 100644
--- a/compiler/ccgstmts.nim
+++ b/compiler/ccgstmts.nim
@@ -17,7 +17,7 @@ const
 
 proc getTraverseProc(p: BProc, v: PSym): Rope =
   if p.config.selectedGC in {gcMarkAndSweep, gcDestructors, gcV2, gcRefc} and
-      optNimV2 notin p.config.globalOptions and
+      optOwnedRefs notin p.config.globalOptions and
       containsGarbageCollectedRef(v.loc.t):
     # we register a specialized marked proc here; this has the advantage
     # that it works out of the box for thread local storage then :-)
@@ -692,7 +692,7 @@ proc genRaiseStmt(p: BProc, t: PNode) =
           [e, makeCString(typ.sym.name.s),
           makeCString(if p.prc != nil: p.prc.name.s else: p.module.module.name.s),
           quotedFilename(p.config, t.info), toLinenumber(t.info)])
-      if optNimV2 in p.config.globalOptions:
+      if optOwnedRefs in p.config.globalOptions:
         lineCg(p, cpsStmts, "$1 = NIM_NIL;$n", [e])
   else:
     genLineDir(p, t)
@@ -1057,7 +1057,7 @@ proc genTry(p: BProc, t: PNode, d: var TLoc) =
       for j in 0 .. blen - 2:
         assert(t.sons[i].sons[j].kind == nkType)
         if orExpr != nil: add(orExpr, "||")
-        let checkFor = if optNimV2 in p.config.globalOptions:
+        let checkFor = if optTinyRtti in p.config.globalOptions:
           genTypeInfo2Name(p.module, t[i][j].typ)
         else:
           genTypeInfo(p.module, t[i][j].typ, t[i][j].info)
@@ -1220,7 +1220,7 @@ proc asgnFieldDiscriminant(p: BProc, e: PNode) =
   getTemp(p, a.t, tmp)
   expr(p, e.sons[1], tmp)
   let field = dotExpr.sons[1].sym
-  if optNimV2 in p.config.globalOptions:
+  if optTinyRtti in p.config.globalOptions:
     let t = dotExpr[0].typ.skipTypes(abstractInst)
     var oldVal, newVal: TLoc
     genCaseObjDiscMapping(p, e[0], t, field, oldVal)
diff --git a/compiler/ccgtrav.nim b/compiler/ccgtrav.nim
index 9374648c4..e494b3e48 100644
--- a/compiler/ccgtrav.nim
+++ b/compiler/ccgtrav.nim
@@ -17,7 +17,7 @@ type
     visitorFrmt: string
 
 const
-  visitorFrmt  = "#nimGCvisit((void*)$1, $2);$n"
+  visitorFrmt = "#nimGCvisit((void*)$1, $2);$n"
 
 proc genTraverseProc(c: TTraversalClosure, accessor: Rope, typ: PType)
 proc genCaseRange(p: BProc, branch: PNode)
@@ -104,7 +104,8 @@ proc genTraverseProc(c: TTraversalClosure, accessor: Rope, typ: PType) =
     elif containsGarbageCollectedRef(typ.lastSon):
       # destructor based seqs are themselves not traced but their data is, if
       # they contain a GC'ed type:
-      genTraverseProcSeq(c, accessor, typ)
+      lineCg(p, cpsStmts, "#nimGCvisitSeq((void*)$1, $2);$n", [accessor, c.visitorFrmt])
+      #genTraverseProcSeq(c, accessor, typ)
   of tyString:
     if tfHasAsgn notin typ.flags:
       lineCg(p, cpsStmts, visitorFrmt, [accessor, c.visitorFrmt])
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim
index fa90bc3f5..3e06da146 100644
--- a/compiler/ccgtypes.nim
+++ b/compiler/ccgtypes.nim
@@ -1365,7 +1365,7 @@ proc genTypeInfo(m: BModule, t: PType; info: TLineInfo): Rope =
   of tySet: genSetInfo(m, t, result, info)
   of tyEnum: genEnumInfo(m, t, result, info)
   of tyObject:
-    if optNimV2 in m.config.globalOptions:
+    if optTinyRtti in m.config.globalOptions:
       genObjectInfoV2(m, t, origType, result, info)
     else:
       genObjectInfo(m, t, origType, result, info)
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index d1ac70d03..0c03c7171 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -347,7 +347,7 @@ proc genObjectInit(p: BProc, section: TCProcSection, t: PType, a: TLoc,
         s = skipTypes(s.sons[0], skipPtrs)
     linefmt(p, section, "$1.m_type = $2;$n", [r, genTypeInfo(p.module, t, a.lode.info)])
   of frEmbedded:
-    if optNimV2 in p.config.globalOptions:
+    if optTinyRtti in p.config.globalOptions:
       localError(p.config, p.prc.info,
         "complex object initialization is not supported with --newruntime")
     # worst case for performance:
diff --git a/compiler/commands.nim b/compiler/commands.nim
index aaa5f6623..0ca99e2ce 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -758,7 +758,9 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
     if pass in {passCmd2, passPP}:
       doAssert(conf != nil)
       incl(conf.features, destructor)
-      incl(conf.globalOptions, optNimV2)
+      incl(conf.globalOptions, optTinyRtti)
+      incl(conf.globalOptions, optOwnedRefs)
+      incl(conf.globalOptions, optSeqDestructors)
       defineSymbol(conf.symbols, "nimV2")
       conf.selectedGC = gcDestructors
       defineSymbol(conf.symbols, "gcdestructors")
diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim
index 5765721d7..40a4b7421 100644
--- a/compiler/injectdestructors.nim
+++ b/compiler/injectdestructors.nim
@@ -486,7 +486,7 @@ proc p(n: PNode; c: var Con): PNode =
       result.add n[0]
       result.add p(n[1], c)
   of nkRaiseStmt:
-    if optNimV2 in c.graph.config.globalOptions and n[0].kind != nkEmpty:
+    if optOwnedRefs in c.graph.config.globalOptions and n[0].kind != nkEmpty:
       if n[0].kind in nkCallKinds:
         let call = p(n[0], c)
         result = copyNode(n)
diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim
index 33eacefbd..612cc3b17 100644
--- a/compiler/lambdalifting.nim
+++ b/compiler/lambdalifting.nim
@@ -257,7 +257,7 @@ proc liftIterSym*(g: ModuleGraph; n: PNode; owner: PSym): PNode =
     result.add(v)
   # add 'new' statement:
   result.add newCall(getSysSym(g, n.info, "internalNew"), env)
-  if optNimV2 in g.config.globalOptions:
+  if optOwnedRefs in g.config.globalOptions:
     createTypeBoundOps(g, nil, env.typ, n.info)
   result.add makeClosure(g, iter, env, n.info)
 
@@ -323,7 +323,7 @@ proc getEnvTypeForOwner(c: var DetectionPass; owner: PSym;
     c.ownerToType[owner.id] = result
 
 proc asOwnedRef(c: DetectionPass; t: PType): PType =
-  if optNimV2 in c.graph.config.globalOptions:
+  if optOwnedRefs in c.graph.config.globalOptions:
     assert t.kind == tyRef
     result = newType(tyOwned, t.owner)
     result.flags.incl tfHasOwned
@@ -542,7 +542,7 @@ proc setupEnvVar(owner: PSym; d: DetectionPass;
       localError d.graph.config, owner.info, "internal error: could not determine closure type"
     result = newEnvVar(d.graph.cache, owner, asOwnedRef(d, envVarType), info)
     c.envVars[owner.id] = result
-    if optNimV2 in d.graph.config.globalOptions:
+    if optOwnedRefs in d.graph.config.globalOptions:
       var v = newSym(skVar, getIdent(d.graph.cache, envName & "Alt"), owner, info)
       v.flags = {sfShadowed, sfGeneratedOp}
       v.typ = envVarType
@@ -572,14 +572,14 @@ proc rawClosureCreation(owner: PSym;
       var v = newNodeI(nkVarSection, env.info)
       addVar(v, env)
       result.add(v)
-      if optNimV2 in d.graph.config.globalOptions:
+      if optOwnedRefs in d.graph.config.globalOptions:
         let unowned = c.unownedEnvVars[owner.id]
         assert unowned != nil
         addVar(v, unowned)
 
     # add 'new' statement:
     result.add(newCall(getSysSym(d.graph, env.info, "internalNew"), env))
-    if optNimV2 in d.graph.config.globalOptions:
+    if optOwnedRefs in d.graph.config.globalOptions:
       let unowned = c.unownedEnvVars[owner.id]
       assert unowned != nil
       let env2 = copyTree(env)
@@ -608,12 +608,12 @@ proc rawClosureCreation(owner: PSym;
       localError(d.graph.config, env.info, "internal error: cannot create up reference")
   # we are not in the sem'check phase anymore! so pass 'nil' for the PContext
   # and hope for the best:
-  if optNimV2 in d.graph.config.globalOptions:
+  if optOwnedRefs in d.graph.config.globalOptions:
     createTypeBoundOps(d.graph, nil, env.typ, owner.info)
 
 proc finishClosureCreation(owner: PSym; d: DetectionPass; c: LiftingPass;
                            info: TLineInfo; res: PNode) =
-  if optNimV2 in d.graph.config.globalOptions:
+  if optOwnedRefs in d.graph.config.globalOptions:
     let unowned = c.unownedEnvVars[owner.id]
     assert unowned != nil
     let nilLit = newNodeIT(nkNilLit, info, unowned.typ)
@@ -637,7 +637,7 @@ proc closureCreationForIter(iter: PNode;
     addVar(vs, vnode)
     result.add(vs)
   result.add(newCall(getSysSym(d.graph, iter.info, "internalNew"), vnode))
-  if optNimV2 in d.graph.config.globalOptions:
+  if optOwnedRefs in d.graph.config.globalOptions:
     createTypeBoundOps(d.graph, nil, vnode.typ, iter.info)
 
   let upField = lookupInRecord(v.typ.skipTypes({tyOwned, tyRef}).n, getIdent(d.graph.cache, upName))
@@ -653,7 +653,7 @@ proc closureCreationForIter(iter: PNode;
 proc accessViaEnvVar(n: PNode; owner: PSym; d: DetectionPass;
                      c: var LiftingPass): PNode =
   var access = setupEnvVar(owner, d, c, n.info)
-  if optNimV2 in d.graph.config.globalOptions:
+  if optOwnedRefs in d.graph.config.globalOptions:
     access = c.unownedEnvVars[owner.id]
   let obj = access.typ.skipTypes({tyOwned, tyRef})
   let field = getFieldFromObj(obj, n.sym)
@@ -923,7 +923,7 @@ proc liftForLoop*(g: ModuleGraph; body: PNode; owner: PSym): PNode =
     result.add(v)
     # add 'new' statement:
     result.add(newCall(getSysSym(g, env.info, "internalNew"), env.newSymNode))
-    if optNimV2 in g.config.globalOptions:
+    if optOwnedRefs in g.config.globalOptions:
       createTypeBoundOps(g, nil, env.typ, body.info)
 
   elif op.kind == nkStmtListExpr:
diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim
index cf9743ea4..69a4a55ee 100644
--- a/compiler/liftdestructors.nim
+++ b/compiler/liftdestructors.nim
@@ -411,7 +411,7 @@ proc closureOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
     call.sons[0] = newSymNode(createMagic(c.g, "deepCopy", mDeepCopy))
     call.sons[1] = y
     body.add newAsgnStmt(x, call)
-  elif optNimV2 in c.g.config.globalOptions and
+  elif optOwnedRefs in c.g.config.globalOptions and
       optRefCheck in c.g.config.options:
     let xx = genBuiltin(c.g, mAccessEnv, "accessEnv", x)
     xx.typ = getSysType(c.g, c.info, tyPointer)
@@ -457,7 +457,7 @@ proc fillBody(c: var TLiftCtx; t: PType; body, x, y: PNode) =
       tyPtr, tyOpt, tyUncheckedArray:
     defaultOp(c, t, body, x, y)
   of tyRef:
-    if optNimV2 in c.g.config.globalOptions and
+    if optOwnedRefs in c.g.config.globalOptions and
         optRefCheck in c.g.config.options:
       weakrefOp(c, t, body, x, y)
     else:
@@ -469,7 +469,7 @@ proc fillBody(c: var TLiftCtx; t: PType; body, x, y: PNode) =
       defaultOp(c, t, body, x, y)
   of tyOwned:
     let base = t.skipTypes(abstractInstOwned)
-    if optNimV2 in c.g.config.globalOptions:
+    if optOwnedRefs in c.g.config.globalOptions:
       case base.kind
       of tyRef:
         ownedRefOp(c, base, body, x, y)
diff --git a/compiler/options.nim b/compiler/options.nim
index d115a20bd..286ca8fcf 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -81,7 +81,11 @@ type                          # please make sure we have under 32 options
     optNoNimblePath
     optHotCodeReloading
     optDynlibOverrideAll
-    optNimV2
+    optSeqDestructors         # active if the implementation uses the new
+                              # string/seq implementation based on destructors
+    optTinyRtti               # active if we use the new "tiny RTTI"
+                              # implementation
+    optOwnedRefs              # active if the Nim compiler knows about 'owned'.
     optMultiMethods
     optNimV019
     optBenchmarkVM            # Enables cpuTime() in the VM
diff --git a/compiler/scriptconfig.nim b/compiler/scriptconfig.nim
index 2dcac5666..e9e720b1b 100644
--- a/compiler/scriptconfig.nim
+++ b/compiler/scriptconfig.nim
@@ -217,7 +217,7 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
   let oldGlobalOptions = conf.globalOptions
   let oldSelectedGC = conf.selectedGC
   undefSymbol(conf.symbols, "nimv2")
-  conf.globalOptions.excl optNimV2
+  conf.globalOptions.excl {optTinyRtti, optOwnedRefs, optSeqDestructors}
   conf.selectedGC = gcUnselected
 
   var m = graph.makeModule(scriptName)
@@ -229,8 +229,8 @@ proc runNimScript*(cache: IdentCache; scriptName: AbsoluteFile;
 
   # watch out, "newruntime" can be set within NimScript itself and then we need
   # to remember this:
-  if optNimV2 in oldGlobalOptions:
-    conf.globalOptions.incl optNimV2
+  if optOwnedRefs in oldGlobalOptions:
+    conf.globalOptions.incl {optTinyRtti, optOwnedRefs, optSeqDestructors}
     defineSymbol(conf.symbols, "nimv2")
   if conf.selectedGC == gcUnselected:
     conf.selectedGC = oldSelectedGC
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 019c30226..ed38f66e1 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -2563,7 +2563,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
         # if isGenericRoutine(result.sym):
         #   localError(c.config, n.info, errInstantiateXExplicitly, s.name.s)
       # "procs literals" are 'owned'
-      if optNimV2 in c.config.globalOptions:
+      if optOwnedRefs in c.config.globalOptions:
         result.typ = makeVarType(c, result.typ, tyOwned)
     else:
       result = semSym(c, n, s, flags)
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim
index b71198fd8..eff7bd825 100644
--- a/compiler/semobjconstr.nim
+++ b/compiler/semobjconstr.nim
@@ -380,7 +380,7 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
   t = skipTypes(t, {tyGenericInst, tyAlias, tySink, tyOwned})
   if t.kind == tyRef:
     t = skipTypes(t.sons[0], {tyGenericInst, tyAlias, tySink, tyOwned})
-    if optNimV2 in c.config.globalOptions:
+    if optOwnedRefs in c.config.globalOptions:
       result.typ = makeVarType(c, result.typ, tyOwned)
       # we have to watch out, there are also 'owned proc' types that can be used
       # multiple times as long as they don't have closures.
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index f5a82b910..518b5e5e8 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1519,7 +1519,7 @@ proc semLambda(c: PContext, n: PNode, flags: TExprFlags): PNode =
   closeScope(c)           # close scope for parameters
   popOwner(c)
   result.typ = s.typ
-  if optNimV2 in c.config.globalOptions:
+  if optOwnedRefs in c.config.globalOptions:
     result.typ = makeVarType(c, result.typ, tyOwned)
 
 proc semInferredLambda(c: PContext, pt: TIdTable, n: PNode): PNode =
@@ -1556,7 +1556,7 @@ proc semInferredLambda(c: PContext, pt: TIdTable, n: PNode): PNode =
   popProcCon(c)
   popOwner(c)
   closeScope(c)
-  if optNimV2 in c.config.globalOptions and result.typ != nil:
+  if optOwnedRefs in c.config.globalOptions and result.typ != nil:
     result.typ = makeVarType(c, result.typ, tyOwned)
   # alternative variant (not quite working):
   # var prc = arg[0].sym
@@ -1948,7 +1948,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
   if isAnon:
     n.kind = nkLambda
     result.typ = s.typ
-    if optNimV2 in c.config.globalOptions:
+    if optOwnedRefs in c.config.globalOptions:
       result.typ = makeVarType(c, result.typ, tyOwned)
   if isTopLevel(c) and s.kind != skIterator and
       s.typ.callConv == ccClosure:
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index 186161169..7e42a120c 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -877,7 +877,7 @@ proc semAnyRef(c: PContext; n: PNode; kind: TTypeKind; prev: PType): PType =
     if tfPartial in result.flags:
       if result.lastSon.kind == tyObject: incl(result.lastSon.flags, tfPartial)
     #if not isNilable: result.flags.incl tfNotNil
-    if isOwned and optNimV2 in c.config.globalOptions:
+    if isOwned and optOwnedRefs in c.config.globalOptions:
       let t = newTypeS(tyOwned, c)
       t.flags.incl tfHasOwned
       t.rawAddSonNoPropagationOfTypeFlags result
@@ -1644,7 +1644,7 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType =
         result = semTypeof(c, n[1], prev)
       elif op.s == "typeof" and n[0].kind == nkSym and n[0].sym.magic == mTypeOf:
         result = semTypeof2(c, n, prev)
-      elif op.s == "owned" and optNimV2 notin c.config.globalOptions and n.len == 2:
+      elif op.s == "owned" and optOwnedRefs notin c.config.globalOptions and n.len == 2:
         result = semTypeExpr(c, n[1], prev)
       else:
         if c.inGenericContext > 0 and n.kind == nkCall:
diff --git a/compiler/spawn.nim b/compiler/spawn.nim
index 7980ac434..b48c67fd3 100644
--- a/compiler/spawn.nim
+++ b/compiler/spawn.nim
@@ -65,7 +65,7 @@ proc addLocalVar(g: ModuleGraph; varSection, varInit: PNode; owner: PSym; typ: P
   vpart.sons[2] = if varInit.isNil: v else: vpart[1]
   varSection.add vpart
   if varInit != nil:
-    if useShallowCopy and typeNeedsNoDeepCopy(typ) or optNimV2 in g.config.globalOptions:
+    if useShallowCopy and typeNeedsNoDeepCopy(typ) or optTinyRtti in g.config.globalOptions:
       varInit.add newFastAsgnStmt(newSymNode(result), v)
     else:
       let deepCopyCall = newNodeI(nkCall, varInit.info, 3)
diff --git a/compiler/transf.nim b/compiler/transf.nim
index afbe41950..b95733a37 100644
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -914,7 +914,7 @@ proc transform(c: PTransf, n: PNode): PTransNode =
       oldDeferAnchor = c.deferAnchor
       c.deferAnchor = n
   if (n.typ != nil and tfHasAsgn in n.typ.flags) or
-      optNimV2 in c.graph.config.globalOptions:
+      optSeqDestructors in c.graph.config.globalOptions:
     c.needsDestroyPass = true
   case n.kind
   of nkSym: