[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
Merge pull request #3530 from 9rnsr/fix12704

Issue 12704 - typeof function literal incorrectly infers attributes