Fix regression #3234 (#3235)

This commit is contained in:
Martin Kinkelin 2019-11-20 20:45:03 +01:00 committed by GitHub
parent 6c76a695f3
commit 649d19e2ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View file

@ -1822,11 +1822,12 @@ FuncDeclaration *getParentFunc(Dsymbol *sym) {
return nullptr;
}
// Static/non-extern(D) functions and function (not delegate) literals don't
// allow access to a parent context, even if they are nested.
// Static functions, non-extern(D) non-member functions and function (not
// delegate) literals don't allow access to a parent context, even if they are
// nested.
if (FuncDeclaration *fd = sym->isFuncDeclaration()) {
bool certainlyNewRoot =
fd->isStatic() || fd->linkage != LINKd ||
fd->isStatic() || (!fd->isThis() && fd->linkage != LINKd) ||
(fd->isFuncLiteralDeclaration() &&
static_cast<FuncLiteralDeclaration *>(fd)->tok == TOKfunction);
if (certainlyNewRoot) {