discard destroys its argument in-place (#9478)
This commit is contained in:
parent
9884129058
commit
f39aa1b40b
2 changed files with 22 additions and 0 deletions
|
|
@ -601,6 +601,10 @@ proc p(n: PNode; c: var Con): PNode =
|
|||
of nkNone..nkNilLit, nkTypeSection, nkProcDef, nkConverterDef, nkMethodDef,
|
||||
nkIteratorDef, nkMacroDef, nkTemplateDef, nkLambda, nkDo, nkFuncDef:
|
||||
result = n
|
||||
of nkDiscardStmt:
|
||||
result = n
|
||||
if n[0].typ != nil and hasDestructor(n[0].typ):
|
||||
result = genDestroy(c, n[0].typ, n[0])
|
||||
of nkCast, nkHiddenStdConv, nkHiddenSubConv, nkConv:
|
||||
result = copyNode(n)
|
||||
# Destination type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue