Skip to content

Commit

Permalink
Make toParentDecl() follow the declaration scope even for static te…
Browse files Browse the repository at this point in the history
…mplates
  • Loading branch information
SSoulaimane committed Apr 19, 2019
1 parent 874f5da commit b52b0c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dmd/dsymbol.d
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ extern (C++) class Dsymbol : ASTNode
* // s.parent == TemplateMixin('mod.test.Foo!().Bar!()')
* // s.toParent() == TemplateInstance('mod.test.Foo!()')
* // s.toParent2() == FuncDeclaration('mod.test')
* // s.toParentDecl() == Module('mod')
*/
final inout(Dsymbol) toParent() inout
{
Expand Down Expand Up @@ -525,7 +526,7 @@ extern (C++) class Dsymbol : ASTNode
if (!p || !p.isTemplateInstance())
return p;
auto ti = p.isTemplateInstance();
if (ti.enclosing && ti.tempdecl && !(cast(TemplateDeclaration)ti.tempdecl).isstatic)
if (ti.tempdecl)
return ti.tempdecl.toParentDecl();
return parent.toParentDecl();
}
Expand Down

0 comments on commit b52b0c7

Please sign in to comment.