From 52b00630c8a9dd770e3cbc0e1911f73299f5cb57 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Tue, 27 Aug 2013 01:49:21 +0300 Subject: [PATCH] fix tisop Adding nil checks on the exit paths for semCompiles errors. This was probably not needed before, because semIndirectOp had a special detection for semCompiles contexts. We could try to restore these, but wouldn't this just postpone the crashes until someone tries the same expressions in nimrod check? One of the previous commits also used errorNode to avoid returning nil. This may be an alaternative approach. --- compiler/semexprs.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index aedd2364d7..5206d88ac7 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -766,7 +766,7 @@ proc semDirectOp(c: PContext, n: PNode, flags: TExprFlags): PNode = let nOrig = n.copyTree #semLazyOpAux(c, n) result = semOverloadedCallAnalyseEffects(c, n, nOrig, flags) - result = afterCallActions(c, result, nOrig, flags) + if result != nil: result = afterCallActions(c, result, nOrig, flags) proc buildStringify(c: PContext, arg: PNode): PNode = if arg.typ != nil and @@ -1994,4 +1994,4 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = else: LocalError(n.info, errInvalidExpressionX, renderTree(n, {renderNoComments})) - incl(result.flags, nfSem) + if result != nil: incl(result.flags, nfSem)