parent
cb6eb5268f
commit
3105909f88
2 changed files with 47 additions and 9 deletions
|
|
@ -534,8 +534,8 @@ proc atomicRefOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
|
||||||
body.add genIf(c, cond, actions)
|
body.add genIf(c, cond, actions)
|
||||||
body.add newAsgnStmt(x, y)
|
body.add newAsgnStmt(x, y)
|
||||||
of attachedDestructor:
|
of attachedDestructor:
|
||||||
actions.add newAsgnStmt(x, newNodeIT(nkNilLit, body.info, t))
|
|
||||||
body.add genIf(c, cond, actions)
|
body.add genIf(c, cond, actions)
|
||||||
|
body.add newAsgnStmt(x, newNodeIT(nkNilLit, body.info, t))
|
||||||
of attachedDeepCopy: assert(false, "cannot happen")
|
of attachedDeepCopy: assert(false, "cannot happen")
|
||||||
of attachedTrace:
|
of attachedTrace:
|
||||||
if isFinal(elemType):
|
if isFinal(elemType):
|
||||||
|
|
@ -583,8 +583,8 @@ proc atomicClosureOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
|
||||||
body.add genIf(c, cond, actions)
|
body.add genIf(c, cond, actions)
|
||||||
body.add newAsgnStmt(x, y)
|
body.add newAsgnStmt(x, y)
|
||||||
of attachedDestructor:
|
of attachedDestructor:
|
||||||
actions.add newAsgnStmt(xenv, newNodeIT(nkNilLit, body.info, xenv.typ))
|
|
||||||
body.add genIf(c, cond, actions)
|
body.add genIf(c, cond, actions)
|
||||||
|
body.add newAsgnStmt(xenv, newNodeIT(nkNilLit, body.info, xenv.typ))
|
||||||
of attachedDeepCopy: assert(false, "cannot happen")
|
of attachedDeepCopy: assert(false, "cannot happen")
|
||||||
of attachedTrace:
|
of attachedTrace:
|
||||||
body.add callCodegenProc(c.g, "nimTraceRefDyn", c.info, genAddrOf(xenv), y)
|
body.add callCodegenProc(c.g, "nimTraceRefDyn", c.info, genAddrOf(xenv), y)
|
||||||
|
|
@ -641,8 +641,8 @@ proc ownedRefOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
|
||||||
body.add genIf(c, x, actions)
|
body.add genIf(c, x, actions)
|
||||||
body.add newAsgnStmt(x, y)
|
body.add newAsgnStmt(x, y)
|
||||||
of attachedDestructor:
|
of attachedDestructor:
|
||||||
actions.add newAsgnStmt(x, newNodeIT(nkNilLit, body.info, t))
|
|
||||||
body.add genIf(c, x, actions)
|
body.add genIf(c, x, actions)
|
||||||
|
body.add newAsgnStmt(x, newNodeIT(nkNilLit, body.info, t))
|
||||||
of attachedDeepCopy: assert(false, "cannot happen")
|
of attachedDeepCopy: assert(false, "cannot happen")
|
||||||
of attachedTrace, attachedDispose: discard
|
of attachedTrace, attachedDispose: discard
|
||||||
|
|
||||||
|
|
@ -694,8 +694,8 @@ proc ownedClosureOp(c: var TLiftCtx; t: PType; body, x, y: PNode) =
|
||||||
body.add genIf(c, xx, actions)
|
body.add genIf(c, xx, actions)
|
||||||
body.add newAsgnStmt(x, y)
|
body.add newAsgnStmt(x, y)
|
||||||
of attachedDestructor:
|
of attachedDestructor:
|
||||||
actions.add newAsgnStmt(xx, newNodeIT(nkNilLit, body.info, xx.typ))
|
|
||||||
body.add genIf(c, xx, actions)
|
body.add genIf(c, xx, actions)
|
||||||
|
body.add newAsgnStmt(xx, newNodeIT(nkNilLit, body.info, xx.typ))
|
||||||
of attachedDeepCopy: assert(false, "cannot happen")
|
of attachedDeepCopy: assert(false, "cannot happen")
|
||||||
of attachedTrace, attachedDispose: discard
|
of attachedTrace, attachedDispose: discard
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,17 @@ discard """
|
||||||
destroyed: false
|
destroyed: false
|
||||||
destroyed: false
|
destroyed: false
|
||||||
1
|
1
|
||||||
|
(x: "0")
|
||||||
|
(x: "1")
|
||||||
|
(x: "2")
|
||||||
|
(x: "3")
|
||||||
|
(x: "4")
|
||||||
|
(x: "5")
|
||||||
|
(x: "6")
|
||||||
|
(x: "7")
|
||||||
|
(x: "8")
|
||||||
|
(x: "9")
|
||||||
|
(x: "10")
|
||||||
closed
|
closed
|
||||||
destroying variable
|
destroying variable
|
||||||
'''
|
'''
|
||||||
|
|
@ -99,10 +110,10 @@ type
|
||||||
MyType = object
|
MyType = object
|
||||||
a: seq[int]
|
a: seq[int]
|
||||||
|
|
||||||
proc re(x: static[string]): static MyType =
|
proc re(x: static[string]): static MyType =
|
||||||
MyType()
|
MyType()
|
||||||
|
|
||||||
proc match(inp: string, rg: static MyType) =
|
proc match(inp: string, rg: static MyType) =
|
||||||
doAssert rg.a.len == 0
|
doAssert rg.a.len == 0
|
||||||
|
|
||||||
match("ac", re"a(b|c)")
|
match("ac", re"a(b|c)")
|
||||||
|
|
@ -125,13 +136,40 @@ var game*: Game
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# issue #14333
|
# issue #14333
|
||||||
|
|
||||||
type
|
type
|
||||||
SimpleLoop = object
|
SimpleLoop = object
|
||||||
|
|
||||||
Lsg = object
|
Lsg = object
|
||||||
loops: seq[ref SimpleLoop]
|
loops: seq[ref SimpleLoop]
|
||||||
root: ref SimpleLoop
|
root: ref SimpleLoop
|
||||||
|
|
||||||
var lsg: Lsg
|
var lsg: Lsg
|
||||||
lsg.loops.add lsg.root
|
lsg.loops.add lsg.root
|
||||||
echo lsg.loops.len
|
echo lsg.loops.len
|
||||||
|
|
||||||
|
# bug #14495
|
||||||
|
type
|
||||||
|
Gah = ref object
|
||||||
|
x: string
|
||||||
|
|
||||||
|
proc bug14495 =
|
||||||
|
var owners: seq[Gah]
|
||||||
|
for i in 0..10:
|
||||||
|
owners.add Gah(x: $i)
|
||||||
|
|
||||||
|
var x: seq[Gah]
|
||||||
|
for i in 0..10:
|
||||||
|
x.add owners[i]
|
||||||
|
|
||||||
|
for i in 0..100:
|
||||||
|
setLen(x, 0)
|
||||||
|
setLen(x, 10)
|
||||||
|
|
||||||
|
for i in 0..x.len-1:
|
||||||
|
if x[i] != nil:
|
||||||
|
echo x[i][]
|
||||||
|
|
||||||
|
for o in owners:
|
||||||
|
echo o[]
|
||||||
|
|
||||||
|
bug14495()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue