No context ptr for nested non-extern(D) functions (#2809)

This commit is contained in:
Martin Kinkelin 2018-08-13 22:45:53 +02:00 committed by GitHub
parent 1704ce63a2
commit d534d370a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

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