[Issue 314] [module] Static, renamed, and selective imports are always public
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Aug 20 07:51:17 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=314
--- Comment #28 from Christian Kamm <kamm-removethis at incasoftware.de> 2010-08-20 07:48:05 PDT ---
> But if you can write the
> essence of the code here, which I think is really only a couple of functions,
> that should be enough.
AliasDeclaration and FuncAliasDeclaration get a new 'importprot' member which
is set for aliases generated by the import declaration and stores the import's
protection.
In ScopeDSymbol::search, we discard aliases which shouldn't be accessible -
unless it's a FuncAliasDeclaration, to avoid making a chain invisible because
the first member is privately imported:
+ // hide the aliases generated by selective or renamed private imports
+ if (s && flags & 1)
+ if (AliasDeclaration* ad = s->isAliasDeclaration())
+ // may be a private alias to a function that is overloaded. these
+ // are sorted out during overload resolution, accept them here
+ if (ad->importprot == PROTprivate &&
!ad->aliassym->isFuncAliasDeclaration())
+ s = NULL;
And for overload resolution, skip over functions that should be invisible:
-int overloadApply(FuncDeclaration *fstart,
+int overloadApply(Module* from, FuncDeclaration *fstart,
int (*fp)(void *, FuncDeclaration *),
void *param)
...
if (fa)
{
- if (overloadApply(fa->funcalias, fp, param))
- return 1;
+ if (fa->getModule() == from || fa->importprot != PROTprivate)
+ if (overloadApply(from, fa->funcalias, fp, param))
+ return 1;
next = fa->overnext;
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list