warn about observerable stores but don't prevent them for 1.2.2 [backport:1.2]; refs https://github.com/nim-lang/RFCs/issues/230 (#14510)

This commit is contained in:
Andreas Rumpf 2020-05-30 19:38:51 +02:00 • committed by GitHub
commit 52c3633223
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 8 deletions

View file

@ -43,8 +43,9 @@ proc preventNrvo(p: BProc; le, ri: PNode): bool =
for i in 1..<ri.len:
let r = ri[i]
if isPartOf(le, r) != arNo: return true
return canRaiseDisp(p, ri[0]) and
(p.nestedTryStmts.len > 0 or locationEscapes(p, le))
if canRaiseDisp(p, ri[0]) and
(p.nestedTryStmts.len > 0 or locationEscapes(p, le)):
message(p.config, le.info, warnObservableStores, $le)
proc hasNoInit(call: PNode): bool {.inline.} =
result = call[0].kind == nkSym and sfNoInit in call[0].sym.flags