Browse Source

Fixed SD2-1313: Protected internal methods not available in derived class code completion

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2492 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
83432070c9
  1. 1
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs
  2. 2
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs
  3. 10
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionClass.cs
  4. 27
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionMethod.cs

1
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs

@ -340,6 +340,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} }
AddParameters(m, method.Parameters); AddParameters(m, method.Parameters);
AddExplicitInterfaceImplementations(method.Overrides, m); AddExplicitInterfaceImplementations(method.Overrides, m);
ReflectionLayer.ReflectionMethod.ApplySpecialsFromAttributes(m);
Methods.Add(m); Methods.Add(m);
} }
} }

2
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs

@ -20,7 +20,7 @@ namespace ICSharpCode.SharpDevelop.Dom
{ {
public const long FileMagic = 0x11635233ED2F428C; public const long FileMagic = 0x11635233ED2F428C;
public const long IndexFileMagic = 0x11635233ED2F427D; public const long IndexFileMagic = 0x11635233ED2F427D;
public const short FileVersion = 10; public const short FileVersion = 11;
ProjectContentRegistry registry; ProjectContentRegistry registry;
string cacheDirectory; string cacheDirectory;

10
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionClass.cs

@ -28,7 +28,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer
} }
foreach (FieldInfo field in type.GetFields(flags)) { foreach (FieldInfo field in type.GetFields(flags)) {
if (!field.IsPublic && !field.IsFamily) continue; if (!field.IsPublic && !field.IsFamily && !field.IsFamilyOrAssembly) continue;
if (!field.IsSpecialName) { if (!field.IsSpecialName) {
Fields.Add(new ReflectionField(field, this)); Fields.Add(new ReflectionField(field, this));
} }
@ -41,12 +41,12 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer
} }
foreach (ConstructorInfo constructorInfo in type.GetConstructors(flags)) { foreach (ConstructorInfo constructorInfo in type.GetConstructors(flags)) {
if (!constructorInfo.IsPublic && !constructorInfo.IsFamily) continue; if (!constructorInfo.IsPublic && !constructorInfo.IsFamily && !constructorInfo.IsFamilyOrAssembly) continue;
Methods.Add(new ReflectionMethod(constructorInfo, this)); Methods.Add(new ReflectionMethod(constructorInfo, this));
} }
foreach (MethodInfo methodInfo in type.GetMethods(flags)) { foreach (MethodInfo methodInfo in type.GetMethods(flags)) {
if (!methodInfo.IsPublic && !methodInfo.IsFamily) continue; if (!methodInfo.IsPublic && !methodInfo.IsFamily && !methodInfo.IsFamilyOrAssembly) continue;
if (!methodInfo.IsSpecialName) { if (!methodInfo.IsSpecialName) {
Methods.Add(new ReflectionMethod(methodInfo, this)); Methods.Add(new ReflectionMethod(methodInfo, this));
} }
@ -62,7 +62,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer
return type.IsSubclassOf(typeof(Delegate)) && type != typeof(MulticastDelegate); return type.IsSubclassOf(typeof(Delegate)) && type != typeof(MulticastDelegate);
} }
static void AddAttributes(IProjectContent pc, IList<IAttribute> list, IList<CustomAttributeData> attributes) internal static void AddAttributes(IProjectContent pc, IList<IAttribute> list, IList<CustomAttributeData> attributes)
{ {
foreach (CustomAttributeData att in attributes) { foreach (CustomAttributeData att in attributes) {
DefaultAttribute a = new DefaultAttribute(att.Constructor.DeclaringType.FullName); DefaultAttribute a = new DefaultAttribute(att.Constructor.DeclaringType.FullName);
@ -82,7 +82,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer
{ {
foreach (IAttribute att in c.Attributes) { foreach (IAttribute att in c.Attributes) {
if (att.Name == "Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute" if (att.Name == "Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute"
|| att.Name == "Boo.Lang.ModuleAttribute") || att.Name == "System.Runtime.CompilerServices.CompilerGlobalScopeAttribute")
{ {
c.ClassType = ClassType.Module; c.ClassType = ClassType.Module;
break; break;

27
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionMethod.cs

@ -12,6 +12,20 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer
{ {
internal class ReflectionMethod : DefaultMethod internal class ReflectionMethod : DefaultMethod
{ {
internal static void ApplySpecialsFromAttributes(DefaultMethod m)
{
if (m.IsStatic) {
foreach (IAttribute a in m.Attributes) {
string attributeName = a.Name;
if (attributeName == "System.Runtime.CompilerServices.ExtensionAttribute"
|| attributeName == "Boo.Lang.ExtensionAttribute")
{
m.IsExtensionMethod = true;
}
}
}
}
public ReflectionMethod(MethodBase methodBase, ReflectionClass declaringType) public ReflectionMethod(MethodBase methodBase, ReflectionClass declaringType)
: base(declaringType, methodBase is ConstructorInfo ? "#ctor" : methodBase.Name) : base(declaringType, methodBase is ConstructorInfo ? "#ctor" : methodBase.Name)
{ {
@ -35,16 +49,6 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer
} }
} }
if (methodBase.IsStatic) {
foreach (CustomAttributeData data in CustomAttributeData.GetCustomAttributes(methodBase)) {
string attributeName = data.Constructor.DeclaringType.FullName;
if (attributeName == "System.Runtime.CompilerServices.ExtensionAttribute"
|| attributeName == "Boo.Lang.ExtensionAttribute")
{
this.IsExtensionMethod = true;
}
}
}
ModifierEnum modifiers = ModifierEnum.None; ModifierEnum modifiers = ModifierEnum.None;
if (methodBase.IsStatic) { if (methodBase.IsStatic) {
modifiers |= ModifierEnum.Static; modifiers |= ModifierEnum.Static;
@ -69,6 +73,9 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer
modifiers |= ModifierEnum.Sealed; modifiers |= ModifierEnum.Sealed;
} }
this.Modifiers = modifiers; this.Modifiers = modifiers;
ReflectionClass.AddAttributes(declaringType.ProjectContent, this.Attributes, CustomAttributeData.GetCustomAttributes(methodBase));
ApplySpecialsFromAttributes(this);
} }
} }
} }

Loading…
Cancel
Save