adds T destructor for refs (#22147)

* adds T destructor for refs

* add `newRefdestructor`

* adds ref overload for destructors

* fixes config
This commit is contained in:
ringabout
2023-06-26 21:10:06 +08:00
committed by GitHub
parent 43a3de9077
commit 4546f5dfe5
3 changed files with 11 additions and 1 deletions

View File

@@ -1068,7 +1068,12 @@ proc symPrototype(g: ModuleGraph; typ: PType; owner: PSym; kind: TTypeAttachedOp
let dest = newSym(skParam, getIdent(g.cache, "dest"), idgen, result, info)
let src = newSym(skParam, getIdent(g.cache, if kind == attachedTrace: "env" else: "src"),
idgen, result, info)
dest.typ = makeVarType(typ.owner, typ, idgen)
if kind == attachedDestructor and typ.kind == tyRef:
dest.typ = typ
else:
dest.typ = makeVarType(typ.owner, typ, idgen)
if kind == attachedTrace:
src.typ = getSysType(g, info, tyPointer)
else: