summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/ast.nim3
-rw-r--r--compiler/lambdalifting.nim2
-rw-r--r--compiler/semstmts.nim2
3 files changed, 4 insertions, 3 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index c43bef926..523831c04 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 ebcd67046..8d4946ab5 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 1beb6b9ed..f19b79c6a 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: