chapel-lang/chapel — pull request #887 by vasslitvinov (2014-11-21 00:29:30+00:00)
Title: Fix for Coverity defect 1219940.

Coverity said:

In resolveMove() we have:

FnSymbol* fn = toFnSymbol(call->parentSymbol);

then we call fn->getReturnSymbol() without ensuring that 'fn' is non-NULL.
Indeed, 'fn' can be NULL - e.g. when 'call' is under a ModuleSymbol.

In practice this defect never fired for us, so this fix is just for Coverity.
While Coverity pointed to a particular occurrence of fn->getReturnSymbol(),
I fixed a couple of other places that I think Coverity could complain about.

* Replaced fn->getReturnSymbol() with 'isReturn', which I compute hopefully
in Coverity-legal way.

* Replaced fn->hasFlag() with call->parentSymbol->hasFlag().
We could instead do 'fn && fn->hasFlag()' - I chose against that
to save a branch.