kranc: Propagate Kranc exit code
CalculationFunction.m: Don't factor out repeated conditionals if the condition contains a gridfunction

This transformation would be wrong in the case of vectorisation.  It is usually used for parameter conditions.
Add test for IfThen factoring