mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-29 03:37:55 +00:00
lift the =dup hook (#21903)
* fixes tests again * remove helper functions * fixes closures, owned refs * final cleanup
This commit is contained in:
@@ -137,7 +137,7 @@ proc new*[T](a: var ref T, finalizer: proc (x: ref T) {.nimcall.}) {.
|
||||
## **Note**: The `finalizer` refers to the type `T`, not to the object!
|
||||
## This means that for each object of type `T` the finalizer will be called!
|
||||
|
||||
proc `=wasMoved`[T](obj: var T) {.magic: "WasMoved", noSideEffect.} =
|
||||
proc `=wasMoved`*[T](obj: var T) {.magic: "WasMoved", noSideEffect.} =
|
||||
## Generic `wasMoved`:idx: implementation that can be overridden.
|
||||
|
||||
proc wasMoved*[T](obj: var T) {.inline, noSideEffect.} =
|
||||
@@ -354,7 +354,7 @@ proc `=destroy`*[T](x: var T) {.inline, magic: "Destroy".} =
|
||||
discard
|
||||
|
||||
when defined(nimHasDup):
|
||||
proc `=dup`*[T](x: ref T): ref T {.inline, magic: "Dup".} =
|
||||
proc `=dup`*[T](x: T): T {.inline, magic: "Dup".} =
|
||||
## Generic `dup`:idx: implementation that can be overridden.
|
||||
discard
|
||||
|
||||
|
||||
@@ -200,10 +200,6 @@ proc nimDecRefIsLast(p: pointer): bool {.compilerRtl, inl.} =
|
||||
when traceCollector:
|
||||
cprintf("[DECREF] %p\n", cell)
|
||||
|
||||
proc nimDupRef(dest: ptr pointer, src: pointer) {.compilerRtl, inl.} =
|
||||
dest[] = src
|
||||
if src != nil: nimIncRef src
|
||||
|
||||
proc GC_unref*[T](x: ref T) =
|
||||
## New runtime only supports this operation for 'ref T'.
|
||||
var y {.cursor.} = x
|
||||
|
||||
Reference in New Issue
Block a user