|
|
|
@ -66,7 +66,13 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver |
|
|
|
public bool IsProtectedAccessAllowed(IType targetType) |
|
|
|
public bool IsProtectedAccessAllowed(IType targetType) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ITypeDefinition typeDef = targetType.GetDefinition(); |
|
|
|
ITypeDefinition typeDef = targetType.GetDefinition(); |
|
|
|
return typeDef != null && typeDef.IsDerivedFrom(currentTypeDefinition); |
|
|
|
if (typeDef == null) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
for (ITypeDefinition c = currentTypeDefinition; c != null; c = c.DeclaringTypeDefinition) { |
|
|
|
|
|
|
|
if (typeDef.IsDerivedFrom(c)) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
@ -126,7 +132,7 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver |
|
|
|
|
|
|
|
|
|
|
|
// PERF: this might hurt performance as this method is called several times (once for each member)
|
|
|
|
// PERF: this might hurt performance as this method is called several times (once for each member)
|
|
|
|
// make sure resolving base types is cheap (caches?) or cache within the MemberLookup instance
|
|
|
|
// make sure resolving base types is cheap (caches?) or cache within the MemberLookup instance
|
|
|
|
if (allowProtectedAccess && currentTypeDefinition.IsDerivedFrom(entity.DeclaringTypeDefinition)) |
|
|
|
if (allowProtectedAccess && t.IsDerivedFrom(entity.DeclaringTypeDefinition)) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|