fixes #6960
This commit is contained in:
parent
2c1f1f21bf
commit
358709e9cb
3 changed files with 34 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ proc fixupCall(p: BProc, le, ri: PNode, d: var TLoc,
|
||||||
if d.k == locNone: getTemp(p, typ.sons[0], d, needsInit=true)
|
if d.k == locNone: getTemp(p, typ.sons[0], d, needsInit=true)
|
||||||
elif d.k notin {locTemp} and not hasNoInit(ri):
|
elif d.k notin {locTemp} and not hasNoInit(ri):
|
||||||
# reset before pass as 'result' var:
|
# reset before pass as 'result' var:
|
||||||
resetLoc(p, d)
|
discard "resetLoc(p, d)"
|
||||||
add(pl, addrLoc(d))
|
add(pl, addrLoc(d))
|
||||||
add(pl, ~");$n")
|
add(pl, ~");$n")
|
||||||
line(p, cpsStmts, pl)
|
line(p, cpsStmts, pl)
|
||||||
|
|
@ -228,7 +228,7 @@ proc genClosureCall(p: BProc, le, ri: PNode, d: var TLoc) =
|
||||||
getTemp(p, typ.sons[0], d, needsInit=true)
|
getTemp(p, typ.sons[0], d, needsInit=true)
|
||||||
elif d.k notin {locTemp} and not hasNoInit(ri):
|
elif d.k notin {locTemp} and not hasNoInit(ri):
|
||||||
# reset before pass as 'result' var:
|
# reset before pass as 'result' var:
|
||||||
resetLoc(p, d)
|
discard "resetLoc(p, d)"
|
||||||
add(pl, addrLoc(d))
|
add(pl, addrLoc(d))
|
||||||
genCallPattern()
|
genCallPattern()
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -726,6 +726,7 @@ proc genProcAux(m: BModule, prc: PSym) =
|
||||||
else:
|
else:
|
||||||
fillResult(resNode)
|
fillResult(resNode)
|
||||||
assignParam(p, res)
|
assignParam(p, res)
|
||||||
|
resetLoc(p, res.loc)
|
||||||
if skipTypes(res.typ, abstractInst).kind == tyArray:
|
if skipTypes(res.typ, abstractInst).kind == tyArray:
|
||||||
#incl(res.loc.flags, lfIndirect)
|
#incl(res.loc.flags, lfIndirect)
|
||||||
res.loc.storage = OnUnknown
|
res.loc.storage = OnUnknown
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,34 @@
|
||||||
|
discard """
|
||||||
|
output: '''obj = (inner: (kind: Just, id: 7))
|
||||||
|
obj.inner.id = 7
|
||||||
|
id = 7
|
||||||
|
obj = (inner: (kind: Just, id: 7))'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #6960
|
||||||
|
|
||||||
|
import future
|
||||||
|
type
|
||||||
|
Kind = enum None, Just, Huge
|
||||||
|
Inner = object
|
||||||
|
case kind: Kind
|
||||||
|
of None: discard
|
||||||
|
of Just: id: int
|
||||||
|
of Huge: a,b,c,d,e,f: string
|
||||||
|
Outer = object
|
||||||
|
inner: Inner
|
||||||
|
|
||||||
|
|
||||||
|
proc shouldDoNothing(id: int): Inner =
|
||||||
|
dump id
|
||||||
|
Inner(kind: Just, id: id)
|
||||||
|
|
||||||
|
var obj = Outer(inner: Inner(kind: Just, id: 7))
|
||||||
|
dump obj
|
||||||
|
dump obj.inner.id
|
||||||
|
obj.inner = shouldDoNothing(obj.inner.id)
|
||||||
|
dump obj
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue