summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-10-12 12:47:34 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-10-12 12:47:34 +0200
commitd6c401acfbb738d0e91df18cc89c40dc1b28525c (patch)
tree726e28cf55a375264148ce8afeb2d8e057350217 /compiler/semstmts.nim
parent8a2f481f9993dcfbc8e682710782ff2fe6725da4 (diff)
downloadNim-d6c401acfbb738d0e91df18cc89c40dc1b28525c.tar.gz
code cleanups for the upcoming reworked destructors
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 70e258bac..ccf332d3a 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -116,7 +116,7 @@ proc semExprBranch(c: PContext, n: PNode): PNode =
     # XXX tyGenericInst here?
     semProcvarCheck(c, result)
     if result.typ.kind == tyVar: result = newDeref(result)
-    semDestructorCheck(c, result, {})
+    when not newDestructors: semDestructorCheck(c, result, {})
 
 proc semExprBranchScope(c: PContext, n: PNode): PNode =
   openScope(c)
@@ -607,7 +607,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
         if def.kind == nkPar: v.ast = def[j]
         setVarType(v, tup.sons[j])
         b.sons[j] = newSymNode(v)
-      addDefer(c, result, v)
+      when not newDestructors: addDefer(c, result, v)
       checkNilable(v)
       if sfCompileTime in v.flags: hasCompileTime = true
   if hasCompileTime: vm.setupCompileTimeVar(c.module, c.cache, result)
@@ -1277,8 +1277,9 @@ proc semOverride(c: PContext, s: PSym, n: PNode) =
   case s.name.s.normalize
   of "destroy", "=destroy":
     doDestructorStuff(c, s, n)
-    if not experimentalMode(c):
-      localError n.info, "use the {.experimental.} pragma to enable destructors"
+    when not newDestructors:
+      if not experimentalMode(c):
+        localError n.info, "use the {.experimental.} pragma to enable destructors"
     incl(s.flags, sfUsed)
   of "deepcopy", "=deepcopy":
     if s.typ.len == 2 and