cleanup destructor building for arrays; still doesn't work
This commit is contained in:
parent
69b32637b1
commit
d634da775d
3 changed files with 15 additions and 27 deletions
|
|
@ -190,7 +190,6 @@ proc resetMemory =
|
||||||
resetRopeCache()
|
resetRopeCache()
|
||||||
resetSysTypes()
|
resetSysTypes()
|
||||||
gOwners = @[]
|
gOwners = @[]
|
||||||
rangeDestructorProc = nil
|
|
||||||
for i in low(buckets)..high(buckets):
|
for i in low(buckets)..high(buckets):
|
||||||
buckets[i] = nil
|
buckets[i] = nil
|
||||||
idAnon = nil
|
idAnon = nil
|
||||||
|
|
@ -237,7 +236,7 @@ proc mainCommand* =
|
||||||
when SimulateCaasMemReset:
|
when SimulateCaasMemReset:
|
||||||
gGlobalOptions.incl(optCaasEnabled)
|
gGlobalOptions.incl(optCaasEnabled)
|
||||||
|
|
||||||
# In "nimrod serve" scenario, each command must reset the registered passes
|
# In "nim serve" scenario, each command must reset the registered passes
|
||||||
clearPasses()
|
clearPasses()
|
||||||
gLastCmdTime = epochTime()
|
gLastCmdTime = epochTime()
|
||||||
appendStr(searchPaths, options.libpath)
|
appendStr(searchPaths, options.libpath)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ var
|
||||||
destructorName = getIdent"destroy_"
|
destructorName = getIdent"destroy_"
|
||||||
destructorParam = getIdent"this_"
|
destructorParam = getIdent"this_"
|
||||||
destructorPragma = newIdentNode(getIdent"destructor", unknownLineInfo())
|
destructorPragma = newIdentNode(getIdent"destructor", unknownLineInfo())
|
||||||
rangeDestructorProc*: PSym
|
|
||||||
|
|
||||||
proc instantiateDestructor(c: PContext, typ: PType): PType
|
proc instantiateDestructor(c: PContext, typ: PType): PType
|
||||||
|
|
||||||
|
|
@ -141,9 +140,7 @@ proc instantiateDestructor(c: PContext, typ: PType): PType =
|
||||||
case t.kind
|
case t.kind
|
||||||
of tySequence, tyArray, tyArrayConstr, tyOpenArray, tyVarargs:
|
of tySequence, tyArray, tyArrayConstr, tyOpenArray, tyVarargs:
|
||||||
if instantiateDestructor(c, t.sons[0]) != nil:
|
if instantiateDestructor(c, t.sons[0]) != nil:
|
||||||
if rangeDestructorProc == nil:
|
t.destructor = getCompilerProc"nimDestroyRange"
|
||||||
rangeDestructorProc = searchInScopes(c, getIdent"nimDestroyRange")
|
|
||||||
t.destructor = rangeDestructorProc
|
|
||||||
return t
|
return t
|
||||||
else:
|
else:
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -173,18 +173,10 @@ proc objectInit(dest: pointer, typ: PNimType) =
|
||||||
|
|
||||||
# ---------------------- assign zero -----------------------------------------
|
# ---------------------- assign zero -----------------------------------------
|
||||||
|
|
||||||
when not defined(nimmixin):
|
proc nimDestroyRange[T](r: T) {.compilerProc.} =
|
||||||
proc destroy(x: int) = discard
|
|
||||||
proc nimDestroyRange*[T](r: T) =
|
|
||||||
# internal proc used for destroying sequences and arrays
|
# internal proc used for destroying sequences and arrays
|
||||||
for i in countup(0, r.len - 1): destroy(r[i])
|
mixin `=destroy`
|
||||||
else:
|
for i in countup(0, r.len - 1): `=destroy`(r[i])
|
||||||
# XXX Why is this exported and no compilerproc? -> compilerprocs cannot be
|
|
||||||
# generic for now
|
|
||||||
proc nimDestroyRange*[T](r: T) =
|
|
||||||
# internal proc used for destroying sequences and arrays
|
|
||||||
mixin destroy
|
|
||||||
for i in countup(0, r.len - 1): destroy(r[i])
|
|
||||||
|
|
||||||
proc genericReset(dest: pointer, mt: PNimType) {.compilerProc, benign.}
|
proc genericReset(dest: pointer, mt: PNimType) {.compilerProc, benign.}
|
||||||
proc genericResetAux(dest: pointer, n: ptr TNimNode) =
|
proc genericResetAux(dest: pointer, n: ptr TNimNode) =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue