Browse Source

Fixed distinguishing the virtual and override modifiers when reading from metadata.

newNRvisualizers
Daniel Grunwald 15 years ago
parent
commit
91f5e30ef2
  1. 12
      ICSharpCode.NRefactory.Tests/TypeSystem/CecilLoaderTests.cs
  2. 6
      ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj
  3. 14
      ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs

12
ICSharpCode.NRefactory.Tests/TypeSystem/CecilLoaderTests.cs

@ -222,10 +222,8 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -222,10 +222,8 @@ namespace ICSharpCode.NRefactory.TypeSystem
Assert.IsFalse(getDecoder.IsStatic);
Assert.IsFalse(getDecoder.IsAbstract);
Assert.IsFalse(getDecoder.IsSealed);
// 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.IsTrue(getDecoder.IsVirtual);
Assert.IsFalse(getDecoder.IsOverride);
Assert.IsFalse(getDecoder.IsVirtual);
Assert.IsTrue(getDecoder.IsOverride);
}
[Test]
@ -241,10 +239,8 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -241,10 +239,8 @@ namespace ICSharpCode.NRefactory.TypeSystem
Assert.IsFalse(getDecoder.IsStatic);
Assert.IsFalse(getDecoder.IsAbstract);
Assert.IsFalse(getDecoder.IsSealed);
// 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.IsTrue(getDecoder.IsVirtual);
Assert.IsFalse(getDecoder.IsOverride);
Assert.IsFalse(getDecoder.IsVirtual);
Assert.IsTrue(getDecoder.IsOverride);
}
}
}

6
ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectGuid>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</ProjectGuid>
@ -36,10 +36,10 @@ @@ -36,10 +36,10 @@
<DefineConstants>TRACE;FULL_AST</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
<DebugType>Full</DebugType>
<Optimize>false</Optimize>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

14
ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs

@ -719,12 +719,18 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -719,12 +719,18 @@ namespace ICSharpCode.NRefactory.TypeSystem
m.IsAbstract = true;
} else {
m.Accessibility = GetAccessibility(method.Attributes);
if (method.IsAbstract)
if (method.IsAbstract) {
m.IsAbstract = true;
else if (method.IsFinal)
m.IsOverride = !method.IsNewSlot;
} else if (method.IsFinal) {
m.IsSealed = true;
else if (method.IsVirtual)
m.IsVirtual = true;
m.IsOverride = !method.IsNewSlot;
} else if (method.IsVirtual) {
if (method.IsNewSlot)
m.IsVirtual = true;
else
m.IsOverride = true;
}
m.IsStatic = method.IsStatic;
}
}

Loading…
Cancel
Save