From 4de6d1be7294e34aa5d09c41db755ce36fae39a6 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 7 May 2013 13:54:38 +0200 Subject: [PATCH] fixed void context detection --- compiler/ast.nim | 3 +++ compiler/lambdalifting.nim | 2 -- compiler/semstmts.nim | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/ast.nim b/compiler/ast.nim index c43bef9263..523831c049 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -768,6 +768,9 @@ const nkCommand, nkCallStrLit, nkHiddenCallConv} nkLambdaKinds* = {nkLambda, nkDo} + declarativeDefs* = {nkProcDef, nkMethodDef, nkIteratorDef, nkConverterDef} + procDefs* = nkLambdaKinds + declarativeDefs + nkSymChoices* = {nkClosedSymChoice, nkOpenSymChoice} nkStrKinds* = {nkStrLit..nkTripleStrLit} diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index ebcd670468..8d4946ab5e 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -104,8 +104,6 @@ discard """ """ const - declarativeDefs* = {nkProcDef, nkMethodDef, nkIteratorDef, nkConverterDef} - procDefs* = nkLambdaKinds + declarativeDefs upName* = ":up" # field name for the 'up' reference paramName* = ":env" envName* = ":env" diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 1beb6b9eda..f19b79c6a8 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -1094,7 +1094,7 @@ proc semStaticStmt(c: PContext, n: PNode): PNode = proc usesResult(n: PNode): bool = # nkStmtList(expr) properly propagates the void context, # so we don't need to process that all over again: - if n.kind notin {nkStmtList, nkStmtListExpr}: + if n.kind notin {nkStmtList, nkStmtListExpr} + procDefs: if isAtom(n): result = n.kind == nkSym and n.sym.kind == skResult elif n.kind == nkReturnStmt: