semantic: Refactor alias resolving code
semantic: Refactor class resolving code