Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed distinguishing the virtual and override modifiers when reading …

…from metadata.
  • Loading branch information...
commit 0305d641c87a27f4ae3a2fa72b809ed6398f785a 1 parent a7e0084
@dgrunwald dgrunwald authored
View
8 src/Main/Base/Test/ReflectionLayerTests.cs
@@ -309,9 +309,7 @@ public void UnicodeEncodingModifiers()
IClass encoding = mscorlib.GetClass("System.Text.UnicodeEncoding", 0);
Assert.AreEqual(ModifierEnum.Public, encoding.Modifiers);
IMethod getDecoder = encoding.Methods.Single(p => p.Name == "GetDecoder");
- // Should be override, but actually is 'virtual'. We cannot do better because 'override' is not encoded in the metadata
- // (the .override directive is unrelated; it's meant for explicit interface implementations)
- Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Virtual, getDecoder.Modifiers);
+ Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Override, getDecoder.Modifiers);
}
[Test]
@@ -320,9 +318,7 @@ public void UTF32EncodingModifiers()
IClass encoding = mscorlib.GetClass("System.Text.UTF32Encoding", 0);
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Sealed, encoding.Modifiers);
IMethod getDecoder = encoding.Methods.Single(p => p.Name == "GetDecoder");
- // Should be override, but actually is 'virtual'. We cannot do better because 'override' is not encoded in the metadata
- // (the .override directive is unrelated; it's meant for explicit interface implementations)
- Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Virtual, getDecoder.Modifiers);
+ Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Override, getDecoder.Modifiers);
}
public class TestClass<A, B> where A : B {
View
5 src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs
@@ -505,7 +505,10 @@ static ModifierEnum TranslateModifiers(MethodDefinition method)
} else if (method.Overrides.Count > 0) {
m |= ModifierEnum.Override;
} else if (method.IsVirtual) {
- m |= ModifierEnum.Virtual;
+ if (method.IsNewSlot)
+ m |= ModifierEnum.Virtual;
+ else
+ m |= ModifierEnum.Override;
}
}
View
2  src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs
@@ -16,7 +16,7 @@ public sealed class DomPersistence
{
public const long FileMagic = 0x11635233ED2F428C;
public const long IndexFileMagic = 0x11635233ED2F427D;
- public const short FileVersion = 27;
+ public const short FileVersion = 28;
ProjectContentRegistry registry;
string cacheDirectory;
View
5 src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionMethod.cs
@@ -65,7 +65,10 @@ public ReflectionMethod(MethodBase methodBase, ReflectionClass declaringType)
} else if (methodBase.IsAbstract) {
modifiers |= ModifierEnum.Abstract;
} else if (methodBase.IsVirtual) {
- modifiers |= ModifierEnum.Virtual;
+ if ((methodBase.Attributes & MethodAttributes.NewSlot) != 0)
+ modifiers |= ModifierEnum.Virtual;
+ else
+ modifiers |= ModifierEnum.Override;
}
this.Modifiers = modifiers;
Please sign in to comment.
Something went wrong with that request. Please try again.