Add in error checking when generating code. Implemented with visitor pattern.