THRIFT-2692 compiler refactor v2

this pull request contains some 'real' refactoring (of my own previous contribution) which shows how much adding new tests can help 

also I've created some RAII style classes for some code generation (like IndentGuard or BracketGuard)