mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-20 19:40:43 +00:00
fixed void context detection
This commit is contained in:
@@ -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}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user