Minor changes to discardable handling (#8155)

This commit is contained in:
LemonBoy 2018-07-01 15:27:14 +02:00 • committed by Andreas Rumpf
commit dbbe311e18
3 changed files with 17 additions and 21 deletions

View file

@ -908,19 +908,6 @@ proc buildEchoStmt(c: PContext, n: PNode): PNode =
proc semExprNoType(c: PContext, n: PNode): PNode =
result = semExpr(c, n, {efWantStmt})
# make an 'if' expression an 'if' statement again for backwards
# compatibility (.discardable was a bad idea!); bug #6980
var isStmt = false
if result.kind == nkIfExpr:
isStmt = true
for condActionPair in result:
let action = condActionPair.lastSon
if not implicitlyDiscardable(action) and not
endsInNoReturn(action):
isStmt = false
if isStmt:
result.kind = nkIfStmt
result.typ = nil
discardCheck(c, result)
proc isTypeExpr(n: PNode): bool =