revert discardable transformation (#10905)

* Revert "Properly wrap discarded statements (#10322)"

This reverts commit 15584879b9.

* add test for implicit discard after defer
* enable t10241 again
* make C++ tests green again
This commit is contained in:
Andreas Rumpf 2019-04-21 09:57:53 +02:00 • committed by GitHub
commit fabc2a7086
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 113 additions and 41 deletions

View file

@ -937,7 +937,7 @@ proc semExprNoType(c: PContext, n: PNode): PNode =
let isPush = hintExtendedContext in c.config.notes
if isPush: pushInfoContext(c.config, n.info)
result = semExpr(c, n, {efWantStmt})
result = discardCheck(c, result, {})
discardCheck(c, result, {})
if isPush: popInfoContext(c.config)
proc isTypeExpr(n: PNode): bool =
@ -1673,7 +1673,7 @@ proc semProcBody(c: PContext, n: PNode): PNode =
a.sons[1] = result
result = semAsgn(c, a)
else:
result = discardCheck(c, result, {})
discardCheck(c, result, {})
if c.p.owner.kind notin {skMacro, skTemplate} and
c.p.resultSym != nil and c.p.resultSym.typ.isMetaType: