Fix effective publicness of protected private and protected internal

This commit is contained in:
Tamas Vajk
2021-04-15 16:31:27 +02:00
parent f715445c7a
commit eea96a5585
2 changed files with 15 additions and 5 deletions

View File

@@ -96,24 +96,32 @@ class Modifiable extends Declaration, @modifiable {
/** Holds if this declaration is `async`. */
predicate isAsync() { this.hasModifier("async") }
private predicate isReallyPrivate() { this.isPrivate() and not this.isProtected() }
/**
* Holds if this declaration is effectively `private` (either directly or
* because one of the enclosing types is `private`).
*/
predicate isEffectivelyPrivate() {
this.isPrivate() or
this.getDeclaringType+().isPrivate() or
this.isReallyPrivate() or
this.getDeclaringType+().(Modifiable).isReallyPrivate() or
this.(Virtualizable).getExplicitlyImplementedInterface().isEffectivelyPrivate()
}
private predicate isReallyInternal() {
this.isInternal() and not this.isProtected()
or
this.isPrivate() and this.isProtected()
}
/**
* Holds if this declaration is effectively `internal` (either directly or
* because one of the enclosing types is `internal`).
*/
predicate isEffectivelyInternal() {
this.isInternal() or
this.getDeclaringType+().isInternal() or
this.(Virtualizable).getExplicitlyImplementedInterface().isInternal()
this.isReallyInternal() or
this.getDeclaringType+().(Modifiable).isReallyInternal() or
this.(Virtualizable).getExplicitlyImplementedInterface().isEffectivelyInternal()
}
/**

View File

@@ -27,3 +27,5 @@
| Modifiers.cs:68:14:68:15 | M1 | internal |
| Modifiers.cs:71:18:71:19 | C2 | public |
| Modifiers.cs:73:17:73:18 | M1 | internal |
| Modifiers.cs:75:32:75:33 | M2 | internal |
| Modifiers.cs:76:33:76:34 | M3 | public |