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
Why?  If it is not noResolve, the reference files should always be searched. and found