bugfixes for exception tracking
This commit is contained in:
parent
6dd2c2d767
commit
42c8fd1fe2
2 changed files with 9 additions and 4 deletions
|
|
@ -123,7 +123,8 @@ proc catches(tracked: PEffects, e: PType) =
|
||||||
setLen(tracked.exc.sons, L)
|
setLen(tracked.exc.sons, L)
|
||||||
|
|
||||||
proc catchesAll(tracked: PEffects) =
|
proc catchesAll(tracked: PEffects) =
|
||||||
setLen(tracked.exc.sons, tracked.bottom)
|
if not isNil(tracked.exc.sons):
|
||||||
|
setLen(tracked.exc.sons, tracked.bottom)
|
||||||
|
|
||||||
proc track(tracked: PEffects, n: PNode)
|
proc track(tracked: PEffects, n: PNode)
|
||||||
proc trackTryStmt(tracked: PEffects, n: PNode) =
|
proc trackTryStmt(tracked: PEffects, n: PNode) =
|
||||||
|
|
@ -156,7 +157,9 @@ proc trackPragmaStmt(tracked: PEffects, n: PNode) =
|
||||||
var it = n.sons[i]
|
var it = n.sons[i]
|
||||||
if whichPragma(it) == wEffects:
|
if whichPragma(it) == wEffects:
|
||||||
# list the computed effects up to here:
|
# list the computed effects up to here:
|
||||||
|
pushInfoContext(n.info)
|
||||||
listEffects(tracked)
|
listEffects(tracked)
|
||||||
|
popInfoContext()
|
||||||
|
|
||||||
proc raisesSpec*(n: PNode): PNode =
|
proc raisesSpec*(n: PNode): PNode =
|
||||||
for i in countup(0, sonsLen(n) - 1):
|
for i in countup(0, sonsLen(n) - 1):
|
||||||
|
|
@ -253,9 +256,10 @@ proc checkRaisesSpec(spec, real: PNode) =
|
||||||
used.incl(s)
|
used.incl(s)
|
||||||
break search
|
break search
|
||||||
# XXX call graph analysis would be nice here!
|
# XXX call graph analysis would be nice here!
|
||||||
localError(spec.info, errInstantiationFrom)
|
pushInfoContext(spec.info)
|
||||||
localError(r.info, errGenerated, "can raise an unlisted exception: " &
|
localError(r.info, errGenerated, "can raise an unlisted exception: " &
|
||||||
typeToString(r.typ))
|
typeToString(r.typ))
|
||||||
|
popInfoContext()
|
||||||
# hint about unnecessarily listed exception types:
|
# hint about unnecessarily listed exception types:
|
||||||
for s in 0 .. <spec.len:
|
for s in 0 .. <spec.len:
|
||||||
if not used.contains(s):
|
if not used.contains(s):
|
||||||
|
|
@ -274,9 +278,10 @@ proc checkMethodEffects*(disp, branch: PSym) =
|
||||||
for s in 0 .. <spec.len:
|
for s in 0 .. <spec.len:
|
||||||
if inheritanceDiff(r.excType, spec[s].typ) <= 0:
|
if inheritanceDiff(r.excType, spec[s].typ) <= 0:
|
||||||
break search
|
break search
|
||||||
localError(branch.info, errInstantiationFrom)
|
pushInfoContext(branch.info)
|
||||||
localError(r.info, errGenerated, "can raise an unlisted exception: " &
|
localError(r.info, errGenerated, "can raise an unlisted exception: " &
|
||||||
typeToString(r.typ))
|
typeToString(r.typ))
|
||||||
|
popInfoContext()
|
||||||
|
|
||||||
proc setEffectsForProcType*(t: PType, n: PNode) =
|
proc setEffectsForProcType*(t: PType, n: PNode) =
|
||||||
var effects = t.n.sons[0]
|
var effects = t.n.sons[0]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
line: 16
|
line: 15
|
||||||
errormsg: "instantiation from here"
|
errormsg: "instantiation from here"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue