[Refactoring] Small cleanup for Expression::checkPurity
Remove code for bug 7107 and 10296 because they are unnecessary anymore.

Now instantiated symbols can reach correct "parent" via `Dsymbol::toParent2()`, because `TemplateInstance::enclosing` is properly calculated in `TemplateInstance::hasNestedArgs`.
fix Issue 12704 - typeof function literal incorrectly infers attributes