fixes #5400
This commit is contained in:
parent
0440aea691
commit
804b0ff99c
2 changed files with 28 additions and 2 deletions
|
|
@ -1103,8 +1103,8 @@ proc asgnFieldDiscriminant(p: BProc, e: PNode) =
|
||||||
genAssignment(p, a, tmp, {})
|
genAssignment(p, a, tmp, {})
|
||||||
|
|
||||||
proc genAsgn(p: BProc, e: PNode, fastAsgn: bool) =
|
proc genAsgn(p: BProc, e: PNode, fastAsgn: bool) =
|
||||||
genLineDir(p, e)
|
|
||||||
if e.sons[0].kind == nkSym and sfGoto in e.sons[0].sym.flags:
|
if e.sons[0].kind == nkSym and sfGoto in e.sons[0].sym.flags:
|
||||||
|
genLineDir(p, e)
|
||||||
genGotoVar(p, e.sons[1])
|
genGotoVar(p, e.sons[1])
|
||||||
elif not fieldDiscriminantCheckNeeded(p, e):
|
elif not fieldDiscriminantCheckNeeded(p, e):
|
||||||
var a: TLoc
|
var a: TLoc
|
||||||
|
|
@ -1114,8 +1114,11 @@ proc genAsgn(p: BProc, e: PNode, fastAsgn: bool) =
|
||||||
initLocExpr(p, e.sons[0], a)
|
initLocExpr(p, e.sons[0], a)
|
||||||
if fastAsgn: incl(a.flags, lfNoDeepCopy)
|
if fastAsgn: incl(a.flags, lfNoDeepCopy)
|
||||||
assert(a.t != nil)
|
assert(a.t != nil)
|
||||||
loadInto(p, e.sons[0], e.sons[1], a)
|
let ri = e.sons[1]
|
||||||
|
genLineDir(p, ri)
|
||||||
|
loadInto(p, e.sons[0], ri, a)
|
||||||
else:
|
else:
|
||||||
|
genLineDir(p, e)
|
||||||
asgnFieldDiscriminant(p, e)
|
asgnFieldDiscriminant(p, e)
|
||||||
|
|
||||||
proc genStmts(p: BProc, t: PNode) =
|
proc genStmts(p: BProc, t: PNode) =
|
||||||
|
|
|
||||||
23
tests/errmsgs/tproper_stacktrace3.nim
Normal file
23
tests/errmsgs/tproper_stacktrace3.nim
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
discard """
|
||||||
|
outputsub: '''tproper_stacktrace3.nim(21) main'''
|
||||||
|
exitcode: 1
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #5400
|
||||||
|
|
||||||
|
type Container = object
|
||||||
|
val: int
|
||||||
|
|
||||||
|
proc actualResolver(x: ptr Container): ptr Container = x
|
||||||
|
|
||||||
|
template resolve(): untyped = actualResolver(db)
|
||||||
|
|
||||||
|
proc myfail(): int =
|
||||||
|
doAssert false
|
||||||
|
|
||||||
|
proc main() =
|
||||||
|
var db: ptr Container = nil
|
||||||
|
# actualResolver(db).val = myfail() # actualResolver is not included in stack trace.
|
||||||
|
resolve().val = myfail() # resolve template is included in stack trace.
|
||||||
|
|
||||||
|
main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue