dmd.access
Enforce visibility contrains such as public
and private
.
Specification: Visibility Attributes
License
Source: access.d
Documentation: https://dlang.org/phobos/dmd_access.html
-
Declaration
bool
checkAccess
(AggregateDeclarationad
, Locloc
, Scope*sc
, Dsymbolsmember
);Do access check for member of this class, this class being the type of the 'this' pointer used to access
smember
. Returnstrue
if the member is not accessible. -
Declaration
bool
checkAccess
(Locloc
, Scope*sc
, Expressione
, Dsymbold
);Check access to
d
for expressione
.d
Returnstrue
if the declaration is not accessible. -
Declaration
bool
checkAccess
(Scope*sc
, Packagep
);Check access to package/module
from scopep
.sc
Parameters
Scope*
sc
scope from which to access to a fully qualified package name
Package
p
the package/module to check access for
Return Value
true
if the package is not accessible.
Because a global symbol table tree is used for imported packages/modules, access to them needs to be checked based on the imports in the scope chain (see https://issues.dlang.org/show_bug.cgi?id=313). -
Declaration
bool
symbolIsVisible
(Modulemod
, Dsymbols
);Check whether symbols
is visible ins
.mod
Parameters
Module
mod
lookup origin
Dsymbol
s
symbol to check for visibility
Return Value
true
ifs
is visible inmod
-
Declaration
bool
symbolIsVisible
(Dsymbolorigin
, Dsymbols
);Same as above, but determines the lookup module from symbols
.origin
-
Declaration
bool
symbolIsVisible
(Scope*sc
, Dsymbols
);Same as above but also checks for protected symbols visible from scope
. Used for qualified name lookup.sc
Parameters
Scope*
sc
lookup scope
Dsymbol
s
symbol to check for visibility
Return Value
true
ifs
is visible by origin -
Declaration
bool
checkSymbolAccess
(Scope*sc
, Dsymbols
);Check if a symbol is visible from a given scope without taking into account the most visible overload.
Parameters
Scope*
sc
lookup scope
Dsymbol
s
symbol to check for visibility
Return Value
true
ifs
is visible by origin -
Declaration
Dsymbol
mostVisibleOverload
(Dsymbols
, Modulemod
= null);Use the most visible overload to check visibility. Later perform an access check on the resolved overload. This function is similar to overloadApply, but doesn't recurse nor resolve aliases because visibility is an attribute of the alias not the aliasee.