HPCC-12408 Various code generator optimizations

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
The problem with dynamic casts is their performance.  Within reason we don't care about the performance in debug mode, but don't want them in release mode.

I changed to dbgassertex because it is cleaner not having conditional code.

That line is checking that the pointer which I am assuming is an IHqlExpression really is one, and isn't an ITypeInfo for instance.