Do not emit references in generated declaration files if the --noresolve flag was set

This fixes a crash in the compiler when generating declarations with /// reference and noResolve
This shouldn't be generated because this should give error on reference='invalid.ts' and if there are any errors in the program we do not generate declarations?