parent
f90620fb32
commit
1cbdc1573a
2 changed files with 16 additions and 3 deletions
|
|
@ -852,13 +852,14 @@ proc trackCall(tracked: PEffects; n: PNode) =
|
||||||
assumeTheWorst(tracked, n, op)
|
assumeTheWorst(tracked, n, op)
|
||||||
gcsafeAndSideeffectCheck()
|
gcsafeAndSideeffectCheck()
|
||||||
else:
|
else:
|
||||||
if strictEffects in tracked.c.features and a.kind == nkSym and a.sym.kind in routineKinds:
|
if strictEffects in tracked.c.features and a.kind == nkSym and
|
||||||
|
a.sym.kind in routineKinds:
|
||||||
propagateEffects(tracked, n, a.sym)
|
propagateEffects(tracked, n, a.sym)
|
||||||
else:
|
else:
|
||||||
mergeRaises(tracked, effectList[exceptionEffects], n)
|
mergeRaises(tracked, effectList[exceptionEffects], n)
|
||||||
mergeTags(tracked, effectList[tagEffects], n)
|
mergeTags(tracked, effectList[tagEffects], n)
|
||||||
gcsafeAndSideeffectCheck()
|
gcsafeAndSideeffectCheck()
|
||||||
if a.kind != nkSym or a.sym.magic notin {mNBindSym, mFinished}:
|
if a.kind != nkSym or a.sym.magic notin {mNBindSym, mFinished, mExpandToAst, mQuoteAst}:
|
||||||
for i in 1..<n.len:
|
for i in 1..<n.len:
|
||||||
trackOperandForIndirectCall(tracked, n[i], op, i, a)
|
trackOperandForIndirectCall(tracked, n[i], op, i, a)
|
||||||
if a.kind == nkSym and a.sym.magic in {mNew, mNewFinalize, mNewSeq}:
|
if a.kind == nkSym and a.sym.magic in {mNew, mNewFinalize, mNewSeq}:
|
||||||
|
|
@ -883,7 +884,7 @@ proc trackCall(tracked: PEffects; n: PNode) =
|
||||||
optStaticBoundsCheck in tracked.currOptions:
|
optStaticBoundsCheck in tracked.currOptions:
|
||||||
checkBounds(tracked, n[1], n[2])
|
checkBounds(tracked, n[1], n[2])
|
||||||
|
|
||||||
if a.kind != nkSym or a.sym.magic != mRunnableExamples:
|
if a.kind != nkSym or a.sym.magic notin {mRunnableExamples, mNBindSym, mExpandToAst, mQuoteAst}:
|
||||||
for i in 0..<n.safeLen:
|
for i in 0..<n.safeLen:
|
||||||
track(tracked, n[i])
|
track(tracked, n[i])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,15 @@ proc fn(a: int, p1, p2: proc()) {.effectsOf: p1.} =
|
||||||
proc main() {.raises: [ValueError].} =
|
proc main() {.raises: [ValueError].} =
|
||||||
fn(1, proc()=discard, proc() = raise newException(IOError, "foo"))
|
fn(1, proc()=discard, proc() = raise newException(IOError, "foo"))
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
# bug #19159
|
||||||
|
|
||||||
|
import macros
|
||||||
|
|
||||||
|
func mkEnter() =
|
||||||
|
template helper =
|
||||||
|
discard
|
||||||
|
when defined pass:
|
||||||
|
helper()
|
||||||
|
else:
|
||||||
|
let ast = getAst(helper())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue