[Resolver] Big refactoring that handles resolution scopes way better. Overall improvement of handling declaration conditions.