mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 07:30:43 +03:00
Nested static functions and function literals do not inherit the parent context
This commit is contained in:
parent
cda8a12112
commit
a2fe91d5e3
2 changed files with 64 additions and 51 deletions
|
@ -1789,12 +1789,7 @@ FuncDeclaration* getParentFunc(Dsymbol* sym, bool stopOnStatic)
|
|||
if (stopOnStatic)
|
||||
{
|
||||
// Fun fact: AggregateDeclarations are not Declarations.
|
||||
if (FuncDeclaration* decl = parent->isFuncDeclaration())
|
||||
{
|
||||
if (decl->isStatic())
|
||||
return NULL;
|
||||
}
|
||||
else if (AggregateDeclaration* decl = parent->isAggregateDeclaration())
|
||||
if (AggregateDeclaration* decl = parent->isAggregateDeclaration())
|
||||
{
|
||||
if (!decl->isNested())
|
||||
return NULL;
|
||||
|
@ -1803,7 +1798,11 @@ FuncDeclaration* getParentFunc(Dsymbol* sym, bool stopOnStatic)
|
|||
parent = parent->parent;
|
||||
}
|
||||
|
||||
return parent ? parent->isFuncDeclaration() : NULL;
|
||||
if (!parent)
|
||||
return NULL;
|
||||
|
||||
FuncDeclaration* fd = parent->isFuncDeclaration();
|
||||
return fd;//(stopOnStatic && fd->isStatic()) ? NULL : fd;
|
||||
}
|
||||
|
||||
LLValue* DtoIndexAggregate(LLValue* src, AggregateDeclaration* ad, VarDeclaration* vd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue