[Semantic Analysis] performance improvements

Cache locations on file depends detector
Read ModuleDeclation from context if it is possible.