Fix mixin("switch") and mixin("interface;") segfault.

CompileStatement::flatten needs to check for errors before adding
statement to AST.

Similarly with CompileDeclaration::compileIt.
Merge pull request #2504 from quickfur/issue8795

Fix issue 8795: segfault on mixin("switch") and mixin("interface;")