Fix the crash in declaration file emit when alias is used before its declaration

Fixes #938