Skip to content

Commit 77f8f3f

Browse files
committed
Adjust comments on isEffectively*
1 parent eea96a5 commit 77f8f3f

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

csharp/ql/src/semmle/code/csharp/Member.qll

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,15 @@ class Modifiable extends Declaration, @modifiable {
9999
private predicate isReallyPrivate() { this.isPrivate() and not this.isProtected() }
100100

101101
/**
102-
* Holds if this declaration is effectively `private` (either directly or
103-
* because one of the enclosing types is `private`).
102+
* Holds if this declaration is effectively `private`. A declaration is considered
103+
* effectively `private` if it can only be referenced from
104+
* - the declaring and its nested types, similarly to `private` declarations, and
105+
* - the enclosing types.
106+
*
107+
* Note that explicit interface implementation are also considered effectively
108+
* `private` if the implemented interface is itself effectively `private`. Finally,
109+
* `private protected` members are not considered effectively `private`, because
110+
* they can be overriden within the declaring assembly.
104111
*/
105112
predicate isEffectivelyPrivate() {
106113
this.isReallyPrivate() or
@@ -115,8 +122,14 @@ class Modifiable extends Declaration, @modifiable {
115122
}
116123

117124
/**
118-
* Holds if this declaration is effectively `internal` (either directly or
119-
* because one of the enclosing types is `internal`).
125+
* Holds if this declaration is effectively `internal`. A declaration is considered
126+
* effectively `internal` if it can only be referenced from the declaring assembly.
127+
*
128+
* Note that friend assemblies declared in `InternalsVisibleToAttribute` are not
129+
* considered. Explicit interface implementation are also considered effectively
130+
* `internal` if the implemented interface is itself effectively `internal`. Finally,
131+
* `internal protected` members are not considered effectively `internal`, because
132+
* they can be overriden outside the declaring assembly.
120133
*/
121134
predicate isEffectivelyInternal() {
122135
this.isReallyInternal() or
@@ -125,8 +138,8 @@ class Modifiable extends Declaration, @modifiable {
125138
}
126139

127140
/**
128-
* Holds if this declaration is effectively `public`, because it
129-
* and all enclosing types are `public`.
141+
* Holds if this declaration is effectively `public`, meaning that it can be
142+
* referenced outside the declaring assembly.
130143
*/
131144
predicate isEffectivelyPublic() { not isEffectivelyPrivate() and not isEffectivelyInternal() }
132145
}

0 commit comments

Comments
 (0)