Esempio n. 1
0
 Accessibility ComputeAccessibility()
 {
     if (IsOverride && (getter == null || setter == null))
     {
         // Overrides may override only one of the accessors, hence calculating the accessibility from
         // the declared accessors is not sufficient. We need to "copy" accessibility from the baseMember.
         foreach (var baseMember in InheritanceHelper.GetBaseMembers(this, includeImplementedInterfaces: false))
         {
             if (!baseMember.IsOverride)
             {
                 // See https://github.com/icsharpcode/ILSpy/issues/2653
                 // "protected internal" (ProtectedOrInternal) accessibility is "reduced"
                 // to "protected" accessibility across assembly boundaries.
                 if (baseMember.Accessibility == Accessibility.ProtectedOrInternal &&
                     this.ParentModule?.PEFile != baseMember.ParentModule?.PEFile)
                 {
                     return(Accessibility.Protected);
                 }
                 else
                 {
                     return(baseMember.Accessibility);
                 }
             }
         }
     }
     return(AccessibilityExtensions.Union(
                this.Getter?.Accessibility ?? Accessibility.None,
                this.Setter?.Accessibility ?? Accessibility.None));
 }
Esempio n. 2
0
 Accessibility ComputeAccessibility()
 {
     if (IsOverride && (getter == null || setter == null))
     {
         foreach (var baseMember in InheritanceHelper.GetBaseMembers(this, includeImplementedInterfaces: false))
         {
             if (!baseMember.IsOverride)
             {
                 return(baseMember.Accessibility);
             }
         }
     }
     return(AccessibilityExtensions.Union(
                this.Getter?.Accessibility ?? Accessibility.None,
                this.Setter?.Accessibility ?? Accessibility.None));
 }