Fix bug in generator that caused compilation to fail.

Fix bug in generator that caused compilation to fail if var declaration
or const declaration is missing.