remove the deprecated 'nil' statement

This commit is contained in:
Andreas Rumpf 2018-05-01 11:09:02 +02:00 • committed by Araq
commit 5ac94d26b3

View file

@ -107,20 +107,13 @@ proc fixNilType(n: PNode) =
proc discardCheck(c: PContext, result: PNode) = proc discardCheck(c: PContext, result: PNode) =
if c.matchedConcept != nil: return if c.matchedConcept != nil: return
if result.typ != nil and result.typ.kind notin {tyStmt, tyVoid}: if result.typ != nil and result.typ.kind notin {tyStmt, tyVoid}:
if result.kind == nkNilLit: if implicitlyDiscardable(result):
result.typ = nil
message(result.info, warnNilStatement)
elif implicitlyDiscardable(result):
var n = result var n = result
result.typ = nil result.typ = nil
while n.kind in skipForDiscardable: while n.kind in skipForDiscardable:
n = n.lastSon n = n.lastSon
n.typ = nil n.typ = nil
elif result.typ.kind != tyError and gCmd != cmdInteractive: elif result.typ.kind != tyError and gCmd != cmdInteractive:
if result.typ.kind == tyNil:
fixNilType(result)
message(result.info, warnNilStatement)
else:
var n = result var n = result
while n.kind in skipForDiscardable: n = n.lastSon while n.kind in skipForDiscardable: n = n.lastSon
var s = "expression '" & $n & "' is of type '" & var s = "expression '" & $n & "' is of type '" &