fixed void context detection

This commit is contained in:
Araq 2013-05-07 13:54:38 +02:00
commit 4de6d1be72
3 changed files with 4 additions and 3 deletions

View file

@ -768,6 +768,9 @@ const
nkCommand, nkCallStrLit, nkHiddenCallConv} nkCommand, nkCallStrLit, nkHiddenCallConv}
nkLambdaKinds* = {nkLambda, nkDo} nkLambdaKinds* = {nkLambda, nkDo}
declarativeDefs* = {nkProcDef, nkMethodDef, nkIteratorDef, nkConverterDef}
procDefs* = nkLambdaKinds + declarativeDefs
nkSymChoices* = {nkClosedSymChoice, nkOpenSymChoice} nkSymChoices* = {nkClosedSymChoice, nkOpenSymChoice}
nkStrKinds* = {nkStrLit..nkTripleStrLit} nkStrKinds* = {nkStrLit..nkTripleStrLit}

View file

@ -104,8 +104,6 @@ discard """
""" """
const const
declarativeDefs* = {nkProcDef, nkMethodDef, nkIteratorDef, nkConverterDef}
procDefs* = nkLambdaKinds + declarativeDefs
upName* = ":up" # field name for the 'up' reference upName* = ":up" # field name for the 'up' reference
paramName* = ":env" paramName* = ":env"
envName* = ":env" envName* = ":env"

View file

@ -1094,7 +1094,7 @@ proc semStaticStmt(c: PContext, n: PNode): PNode =
proc usesResult(n: PNode): bool = proc usesResult(n: PNode): bool =
# nkStmtList(expr) properly propagates the void context, # nkStmtList(expr) properly propagates the void context,
# so we don't need to process that all over again: # 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): if isAtom(n):
result = n.kind == nkSym and n.sym.kind == skResult result = n.kind == nkSym and n.sym.kind == skResult
elif n.kind == nkReturnStmt: elif n.kind == nkReturnStmt: