Skip to content

Commit

Permalink
Move newScope method from dclass to dsymbolsem
Browse files Browse the repository at this point in the history
  • Loading branch information
dchidindu5 committed Oct 31, 2024
1 parent a2194b0 commit a88cfdb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
26 changes: 0 additions & 26 deletions compiler/src/dmd/dclass.d
Original file line number Diff line number Diff line change
Expand Up @@ -409,19 +409,6 @@ extern (C++) class ClassDeclaration : AggregateDeclaration
return cd;
}

override Scope* newScope(Scope* sc)
{
auto sc2 = super.newScope(sc);
if (isCOMclass())
{
/* This enables us to use COM objects under Linux and
* work with things like XPCOM
*/
sc2.linkage = target.systemLinkage();
}
return sc2;
}

/*********************************************
* Determine if 'this' is a base class of cd.
* This is used to detect circular inheritance only.
Expand Down Expand Up @@ -975,19 +962,6 @@ extern (C++) final class InterfaceDeclaration : ClassDeclaration
return id;
}


override Scope* newScope(Scope* sc)
{
auto sc2 = super.newScope(sc);
if (com)
sc2.linkage = LINK.windows;
else if (classKind == ClassKind.cpp)
sc2.linkage = LINK.cpp;
else if (classKind == ClassKind.objc)
sc2.linkage = LINK.objc;
return sc2;
}

/*******************************************
* Determine if 'this' is a base class of cd.
* (Actually, if it is an interface supported by cd)
Expand Down
26 changes: 25 additions & 1 deletion compiler/src/dmd/dsymbolsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -7482,8 +7482,32 @@ private extern(C++) class NewScopeVisitor : Visitor
}
sc = sc2;
}
}

override void visit(ClassDeclaration cld)
{
auto sc2 = cld.newScope(sc);
if (cld.isCOMclass())
{
/* This enables us to use COM objects under Linux and
* work with things like XPCOM
*/
sc2.linkage = target.systemLinkage();
}
sc = sc2;
}

override void visit(InterfaceDeclaration ifd)
{
auto sc2 = ifd.newScope(sc);
if (ifd.com)
sc2.linkage = LINK.windows;
else if (ifd.classKind == ClassKind.cpp)
sc2.linkage = LINK.cpp;
else if (ifd.classKind == ClassKind.objc)
sc2.linkage = LINK.objc;
sc = sc2;
}
}

extern(C++) Dsymbols* include(Dsymbol d, Scope* sc)
{
Expand Down

0 comments on commit a88cfdb

Please sign in to comment.