Browse Source

Fixed SD2-1199 - Override completion list for KeyedCollection class contains invalid methods. ReflectionMethod and ReflectionProperty classes now set the Sealed modifier if the method or property getter/setter is marked as final. Incremented DomPersistence.FileVersion to invalidate the cached files. Code generators now use the OverrideCompletionDataProvider class to determine the overridable methods and properties instead of using their own implementation.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2340 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 19 years ago
parent
commit
a588fc4a17
  1. 14
      src/Main/Base/Project/Src/TextEditor/Commands/CodeGenerators/OverrideMethodsCodeGenerator.cs
  2. 20
      src/Main/Base/Project/Src/TextEditor/Commands/CodeGenerators/OverridePropertiesCodeGenerator.cs
  3. 66
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/OverrideCompletionDataProvider.cs
  4. 63
      src/Main/Base/Test/AbstractDecorationIsOverridableTestFixture.cs
  5. 142
      src/Main/Base/Test/CollectionClassOverridesTestFixture.cs
  6. 143
      src/Main/Base/Test/ExceptionClassOverridesTestFixture.cs
  7. 17
      src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj
  8. 134
      src/Main/Base/Test/OverridableMethodsTestFixture.cs
  9. 134
      src/Main/Base/Test/OverridablePropertiesTestFixture.cs
  10. 87
      src/Main/Base/Test/Utils/MockAmbience.cs
  11. 354
      src/Main/Base/Test/Utils/MockClass.cs
  12. 25
      src/Main/Base/Test/Utils/MockDecoration.cs
  13. 137
      src/Main/Base/Test/Utils/MockDefaultReturnType.cs
  14. 276
      src/Main/Base/Test/Utils/MockMethod.cs
  15. 30
      src/Main/Base/Test/Utils/MockProject.cs
  16. 294
      src/Main/Base/Test/Utils/MockProperty.cs
  17. 2
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs
  18. 3
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionMethod.cs
  19. 4
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionProperty.cs

14
src/Main/Base/Project/Src/TextEditor/Commands/CodeGenerators/OverrideMethodsCodeGenerator.cs

@ -9,6 +9,7 @@ using System; @@ -9,6 +9,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.NRefactory.Ast;
@ -36,17 +37,8 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands @@ -36,17 +37,8 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
protected override void InitContent()
{
foreach (IClass c in currentClass.ClassInheritanceTree) {
if (c.FullyQualifiedName != currentClass.FullyQualifiedName) {
foreach (IMethod method in c.Methods) {
if (!method.IsPrivate && (method.IsAbstract || method.IsVirtual || method.IsOverride)) {
MethodWrapper newWrapper = new MethodWrapper(method);
if (!Content.Contains(newWrapper)) {
Content.Add(newWrapper);
}
}
}
}
foreach (IMethod m in OverrideCompletionDataProvider.GetOverridableMethods(currentClass)) {
Content.Add(new MethodWrapper(m));
}
Content.Sort();
}

20
src/Main/Base/Project/Src/TextEditor/Commands/CodeGenerators/OverridePropertiesCodeGenerator.cs

@ -9,6 +9,7 @@ using System; @@ -9,6 +9,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.NRefactory.Ast;
@ -36,23 +37,8 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands @@ -36,23 +37,8 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
protected override void InitContent()
{
foreach (IClass c in currentClass.ClassInheritanceTree) {
if (c.FullyQualifiedName != currentClass.FullyQualifiedName) {
foreach (IProperty property in c.Properties) {
if (!property.IsPrivate && (property.IsAbstract || property.IsVirtual || property.IsOverride)) {
bool alreadyAdded = false;
foreach (PropertyWrapper w in Content) {
if (w.Property.Name == property.Name) {
alreadyAdded = true;
break;
}
}
if (!alreadyAdded) {
Content.Add(new PropertyWrapper(property));
}
}
}
}
foreach (IProperty p in OverrideCompletionDataProvider.GetOverridableProperties(currentClass)) {
Content.Add(new PropertyWrapper(p));
}
Content.Sort();
}

66
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/OverrideCompletionDataProvider.cs

@ -17,6 +17,48 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -17,6 +17,48 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
{
public class OverrideCompletionDataProvider : AbstractCompletionDataProvider
{
/// <summary>
/// Gets a list of overridable methods from the specified class.
/// A better location for this method is in the DefaultClass
/// class and the IClass interface.
/// </summary>
public static IMethod[] GetOverridableMethods(IClass c)
{
if (c == null) {
throw new ArgumentException("c");
}
List<IMethod> methods = new List<IMethod>();
foreach (IMethod m in c.DefaultReturnType.GetMethods()) {
if (m.IsOverridable && !m.IsConst && !m.IsPrivate) {
if (m.DeclaringType.FullyQualifiedName != c.FullyQualifiedName) {
methods.Add(m);
}
}
}
return methods.ToArray();
}
/// <summary>
/// Gets a list of overridable properties from the specified class.
/// </summary>
public static IProperty[] GetOverridableProperties(IClass c)
{
if (c == null) {
throw new ArgumentException("c");
}
List<IProperty> properties = new List<IProperty>();
foreach (IProperty p in c.DefaultReturnType.GetProperties()) {
if (p.IsOverridable && !p.IsConst && !p.IsPrivate) {
if (p.DeclaringType.FullyQualifiedName != c.FullyQualifiedName) {
properties.Add(p);
}
}
}
return properties.ToArray();
}
public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
{
ParseInformation parseInfo = ParserService.GetParseInformation(fileName);
@ -24,27 +66,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -24,27 +66,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
IClass c = parseInfo.MostRecentCompilationUnit.GetInnermostClass(textArea.Caret.Line, textArea.Caret.Column);
if (c == null) return null;
List<ICompletionData> result = new List<ICompletionData>();
foreach (IMethod m in c.DefaultReturnType.GetMethods()) {
if (m.IsPublic || m.IsProtected) {
if (m.IsAbstract || m.IsVirtual || m.IsOverride) {
if (!m.IsSealed && !m.IsConst) {
if (m.DeclaringType.FullyQualifiedName != c.FullyQualifiedName) {
result.Add(new OverrideCompletionData(m));
}
}
}
}
foreach (IMethod m in GetOverridableMethods(c)) {
result.Add(new OverrideCompletionData(m));
}
foreach (IProperty m in c.DefaultReturnType.GetProperties()) {
if (m.IsPublic || m.IsProtected) {
if (m.IsAbstract || m.IsVirtual || m.IsOverride) {
if (!m.IsSealed && !m.IsConst) {
if (m.DeclaringType.FullyQualifiedName != c.FullyQualifiedName) {
result.Add(new OverrideCompletionData(m));
}
}
}
}
foreach (IProperty p in GetOverridableProperties(c)) {
result.Add(new OverrideCompletionData(p));
}
return result.ToArray();
}

63
src/Main/Base/Test/AbstractDecorationIsOverridableTestFixture.cs

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Tests.Utils;
using NUnit.Framework;
namespace ICSharpCode.SharpDevelop.Tests
{
/// <summary>
/// Tests that the IsOverridable property returns the expected value.
/// </summary>
[TestFixture]
public class AbstractDecorationIsOverridableTestFixture
{
MockDecoration decoration;
[SetUp]
public void SetUp()
{
decoration = new MockDecoration();
}
[Test]
public void NotOverridableByDefault()
{
Assert.IsFalse(decoration.IsOverridable);
}
[Test]
public void IsOverrideSet()
{
decoration.Modifiers = ModifierEnum.Override;
Assert.IsTrue(decoration.IsOverridable);
}
[Test]
public void IsVirtualSet()
{
decoration.Modifiers = ModifierEnum.Virtual;
Assert.IsTrue(decoration.IsOverridable);
}
[Test]
public void IsAbstractSet()
{
decoration.Modifiers = ModifierEnum.Abstract;
Assert.IsTrue(decoration.IsOverridable);
}
[Test]
public void IsAbstractAndSealedSet()
{
decoration.Modifiers = ModifierEnum.Abstract | ModifierEnum.Sealed;
Assert.IsFalse(decoration.IsOverridable);
}
}
}

142
src/Main/Base/Test/CollectionClassOverridesTestFixture.cs

@ -0,0 +1,142 @@ @@ -0,0 +1,142 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.DefaultEditor.Commands;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.CSharp;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Tests.Utils;
using NUnit.Framework;
namespace ICSharpCode.SharpDevelop.Tests
{
/// <summary>
/// SD2-1199. Tests the available overrides for the
/// System.Collections.ObjectModel.Collection class.
/// </summary>
[TestFixture]
public class CollectionClassOverridesTestFixture
{
[TestFixtureSetUp]
public void SetUpFixture()
{
if (!PropertyService.Initialized) {
PropertyService.InitializeService(String.Empty, String.Empty, String.Empty);
}
}
/// <summary>
/// This shows how to get the list of overridable methods in the
/// Collection class using reflection only.
/// </summary>
public void GetMethodsThroughReflection()
{
Assembly a = Assembly.Load("mscorlib");
Type t = a.GetType("System.Collections.ObjectModel.Collection`1");
List<string> methodNames = new List<string>();
BindingFlags bindingFlags = BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.DeclaredOnly |
BindingFlags.Public;
foreach (MethodInfo m in t.GetMethods(bindingFlags)) {
if (m.IsVirtual && !m.IsSpecialName && !m.IsFinal) {
methodNames.Add(m.Name);
}
}
List<string> expectedMethodNames = new List<string>();
expectedMethodNames.Add("ClearItems");
expectedMethodNames.Add("InsertItem");
expectedMethodNames.Add("RemoveItem");
expectedMethodNames.Add("SetItem");
StringBuilder sb = new StringBuilder();
foreach (string s in methodNames.ToArray()) {
sb.AppendLine(s);
}
Assert.AreEqual(expectedMethodNames.ToArray(), methodNames.ToArray(), sb.ToString());
}
/// <summary>
/// Tests that the IsSealed property is set for methods that are
/// flagged as final. The ReflectionMethod class was not setting
/// this correctly.
/// </summary>
[Test]
public void ExpectedMethodsFromProjectContent()
{
ProjectContentRegistry registry = new ProjectContentRegistry();
IProjectContent mscorlibProjectContent = registry.Mscorlib;
IClass c = mscorlibProjectContent.GetClass("System.Collections.ObjectModel.Collection");
List<string> methodNames = new List<string>();
foreach (IMethod m in c.Methods) {
if (m.IsVirtual && !m.IsSealed) {
methodNames.Add(m.Name);
}
}
List<string> expectedMethodNames = new List<string>();
expectedMethodNames.Add("ClearItems");
expectedMethodNames.Add("InsertItem");
expectedMethodNames.Add("RemoveItem");
expectedMethodNames.Add("SetItem");
Assert.AreEqual(expectedMethodNames.ToArray(), methodNames.ToArray());
}
/// <summary>
/// Tests that the OverrideMethodsCodeGenerator returns the correct
/// methods for the System.Collections.ObjectModel.Collection type.
/// </summary>
[Test]
public void CodeGeneratorMethods()
{
ProjectContentRegistry registry = new ProjectContentRegistry();
IProjectContent mscorlibProjectContent = registry.Mscorlib;
IClass collectionClass = mscorlibProjectContent.GetClass("System.Collections.ObjectModel.Collection");
DefaultProjectContent projectContent = new DefaultProjectContent();
DefaultCompilationUnit unit = new DefaultCompilationUnit(projectContent);
DefaultClass c = new DefaultClass(unit, "MyCollection");
c.BaseTypes.Add(new DefaultReturnType(collectionClass));
MockProject project = new MockProject();
ProjectService.CurrentProject = project;
OverrideMethodsCodeGenerator codeGenerator = new OverrideMethodsCodeGenerator();
codeGenerator.Initialize(c);
List<string> methods = new List<string>();
foreach (object o in codeGenerator.Content) {
methods.Add(o.ToString());
}
List<string> expectedMethods = new List<string>();
expectedMethods.Add("ClearItems");
expectedMethods.Add("Equals");
expectedMethods.Add("Finalize");
expectedMethods.Add("GetHashCode");
expectedMethods.Add("InsertItem");
expectedMethods.Add("RemoveItem");
expectedMethods.Add("SetItem");
expectedMethods.Add("ToString");
Assert.AreEqual(expectedMethods.ToArray(), methods.ToArray());
}
}
}

143
src/Main/Base/Test/ExceptionClassOverridesTestFixture.cs

@ -0,0 +1,143 @@ @@ -0,0 +1,143 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.DefaultEditor.Commands;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.CSharp;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Tests.Utils;
using NUnit.Framework;
namespace ICSharpCode.SharpDevelop.Tests
{
/// <summary>
/// Tests the available overrides for the
/// System.Exception class.
/// </summary>
[TestFixture]
public class ExceptionClassOverridesTestFixture
{
[TestFixtureSetUp]
public void SetUpFixture()
{
if (!PropertyService.Initialized) {
PropertyService.InitializeService(String.Empty, String.Empty, String.Empty);
}
}
/// <summary>
/// This shows how to get the list of overridable properties in the
/// Exception class using reflection only.
/// </summary>
public void GetPropertiesThroughReflection()
{
Assembly a = Assembly.Load("mscorlib");
Type t = a.GetType("System.Exception");
List<string> propertyNames = new List<string>();
BindingFlags bindingFlags = BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.DeclaredOnly |
BindingFlags.Public;
foreach (PropertyInfo p in t.GetProperties(bindingFlags)) {
MethodInfo m = p.GetGetMethod(true);
if (m.IsVirtual && !m.IsPrivate && !m.IsFinal) {
propertyNames.Add(p.Name);
}
}
List<string> expectedPropertyNames = new List<string>();
expectedPropertyNames.Add("Data");
expectedPropertyNames.Add("HelpLink");
expectedPropertyNames.Add("Message");
expectedPropertyNames.Add("Source");
expectedPropertyNames.Add("StackTrace");
StringBuilder sb = new StringBuilder();
foreach (string s in propertyNames.ToArray()) {
sb.AppendLine(s);
}
Assert.AreEqual(expectedPropertyNames.ToArray(), propertyNames.ToArray(), sb.ToString());
}
/// <summary>
/// Tests that the IsSealed property is set for properties that are
/// flagged as final. The ReflectionProperty class was not setting
/// this correctly.
/// </summary>
[Test]
public void ExpectedPropertiesFromProjectContent()
{
ProjectContentRegistry registry = new ProjectContentRegistry();
IProjectContent mscorlibProjectContent = registry.Mscorlib;
IClass c = mscorlibProjectContent.GetClass("System.Exception");
List<string> propertyNames = new List<string>();
foreach (IProperty p in c.Properties) {
if (p.IsVirtual && !p.IsSealed) {
propertyNames.Add(p.Name);
}
}
propertyNames.Sort();
List<string> expectedPropertyNames = new List<string>();
expectedPropertyNames.Add("Data");
expectedPropertyNames.Add("HelpLink");
expectedPropertyNames.Add("Message");
expectedPropertyNames.Add("Source");
expectedPropertyNames.Add("StackTrace");
Assert.AreEqual(expectedPropertyNames.ToArray(), propertyNames.ToArray());
}
/// <summary>
/// Tests that the OverridePropertyCodeGenerator returns the correct
/// methods for the System.Exception type.
/// </summary>
[Test]
public void CodeGeneratorProperties()
{
ProjectContentRegistry registry = new ProjectContentRegistry();
IProjectContent mscorlibProjectContent = registry.Mscorlib;
IClass exceptionClass = mscorlibProjectContent.GetClass("System.Exception");
DefaultProjectContent projectContent = new DefaultProjectContent();
DefaultCompilationUnit unit = new DefaultCompilationUnit(projectContent);
DefaultClass c = new DefaultClass(unit, "MyException");
c.BaseTypes.Add(new DefaultReturnType(exceptionClass));
MockProject project = new MockProject();
ProjectService.CurrentProject = project;
OverridePropertiesCodeGenerator codeGenerator = new OverridePropertiesCodeGenerator();
codeGenerator.Initialize(c);
List<string> properties = new List<string>();
foreach (object o in codeGenerator.Content) {
properties.Add(o.ToString());
}
List<string> expectedProperties = new List<string>();
expectedProperties.Add("Data");
expectedProperties.Add("HelpLink");
expectedProperties.Add("Message");
expectedProperties.Add("Source");
expectedProperties.Add("StackTrace");
Assert.AreEqual(expectedProperties.ToArray(), properties.ToArray());
}
}
}

17
src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj

@ -48,9 +48,14 @@ @@ -48,9 +48,14 @@
<Reference Include="Microsoft.Build.Engine" />
</ItemGroup>
<ItemGroup>
<Compile Include="AbstractDecorationIsOverridableTestFixture.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="CSharpExpressionFinderTests.cs" />
<Compile Include="ExceptionClassOverridesTestFixture.cs" />
<Compile Include="NRefactoryResolverTests.cs" />
<Compile Include="CollectionClassOverridesTestFixture.cs" />
<Compile Include="OverridableMethodsTestFixture.cs" />
<Compile Include="OverridablePropertiesTestFixture.cs" />
<Compile Include="ReflectionLayerTests.cs" />
<Compile Include="GenericResolverTests.cs" />
<Compile Include="InnerClassesResolverTests.cs" />
@ -59,6 +64,13 @@ @@ -59,6 +64,13 @@
<Compile Include="OverloadFinding.cs" />
<Compile Include="SearchGenericClassTests.cs" />
<Compile Include="MemberLookupHelperTests.cs" />
<Compile Include="Utils\MockAmbience.cs" />
<Compile Include="Utils\MockClass.cs" />
<Compile Include="Utils\MockDecoration.cs" />
<Compile Include="Utils\MockDefaultReturnType.cs" />
<Compile Include="Utils\MockMethod.cs" />
<Compile Include="Utils\MockProject.cs" />
<Compile Include="Utils\MockProperty.cs" />
<Compile Include="VBExpressionFinderTests.cs" />
<Compile Include="WebReferences\WebReferenceProjectItemsTest.cs" />
<Compile Include="WebReferences\ProjectHasExistingWebRefFolderTest.cs" />
@ -93,6 +105,10 @@ @@ -93,6 +105,10 @@
<Compile Include="SharpDevelopColorDialogTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
</ProjectReference>
<ProjectReference Include="..\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
@ -125,6 +141,7 @@ @@ -125,6 +141,7 @@
<Link>ICSharpCode.TextEditor.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Folder Include="Utils" />
<Folder Include="WebReferences" />
<Folder Include="Templates" />
<Folder Include="Services_Navigation" />

134
src/Main/Base/Test/OverridableMethodsTestFixture.cs

@ -0,0 +1,134 @@ @@ -0,0 +1,134 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Tests.Utils;
using NUnit.Framework;
namespace ICSharpCode.SharpDevelop.Tests
{
/// <summary>
/// Tests the OverrideCompletionDataProvider GetOverridableMethods.
/// This method should be added to the IClass interface.
/// </summary>
[TestFixture]
public class OverridableMethodsTestFixture
{
MockClass c;
MockDefaultReturnType returnType;
List<IMethod> expectedMethods;
MockClass declaringType;
[SetUp]
public void SetUp()
{
expectedMethods = new List<IMethod>();
c = new MockClass("MyClass");
declaringType = new MockClass("MyDeclaringType");
returnType = new MockDefaultReturnType();
c.DefaultReturnType = returnType;
}
/// <summary>
/// Add one overridable method to the return type and this
/// should be returned in the list of overridable methods.
/// </summary>
[Test]
public void OneOverridableMethodReturned()
{
MockMethod method = new MockMethod("Run");
method.DeclaringType = declaringType;
method.IsOverridable = true;
returnType.Methods.Add(method);
expectedMethods.Add(method);
IMethod[] methods = OverrideCompletionDataProvider.GetOverridableMethods(c);
AssertAreMethodsEqual(expectedMethods, methods);
}
/// <summary>
/// Make sure that an overridable method is not returned when
/// it is part of the class being considered.
/// </summary>
[Test]
public void OverridableMethodPartOfClass()
{
MockMethod method = new MockMethod("Run");
method.DeclaringType = c;
method.IsOverridable = true;
returnType.Methods.Add(method);
IMethod[] methods = OverrideCompletionDataProvider.GetOverridableMethods(c);
AssertAreMethodsEqual(expectedMethods, methods);
}
/// <summary>
/// An overridable but const method should not be returned.
/// </summary>
[Test]
public void OverridableConstMethodNotReturned()
{
MockMethod method = new MockMethod("Run");
method.DeclaringType = declaringType;
method.IsOverridable = true;
method.IsConst = true;
returnType.Methods.Add(method);
IMethod[] methods = OverrideCompletionDataProvider.GetOverridableMethods(c);
AssertAreMethodsEqual(expectedMethods, methods);
}
/// <summary>
/// An overridable but private method should not be returned.
/// </summary>
[Test]
public void OverridablePrivateMethodNotReturned()
{
MockMethod method = new MockMethod("Run");
method.DeclaringType = declaringType;
method.IsOverridable = true;
method.IsPrivate = true;
returnType.Methods.Add(method);
IMethod[] methods = OverrideCompletionDataProvider.GetOverridableMethods(c);
AssertAreMethodsEqual(expectedMethods, methods);
}
[Test]
[ExpectedException(typeof(ArgumentException))]
public void NullArgument()
{
OverrideCompletionDataProvider.GetOverridableMethods(null);
}
void AssertAreMethodsEqual(List<IMethod> expectedMethods, IMethod[] methods)
{
// Get a list of expected method names.
List<string> expectedMethodNames = new List<string>();
foreach (IMethod expectedMethod in expectedMethods) {
expectedMethodNames.Add(expectedMethod.Name);
}
// Get a list of actual method names.
List<string> methodNames = new List<string>();
foreach (IMethod m in methods) {
methodNames.Add(m.Name);
}
// Compare the two arrays.
Assert.AreEqual(expectedMethodNames.ToArray(), methodNames.ToArray());
}
}
}

134
src/Main/Base/Test/OverridablePropertiesTestFixture.cs

@ -0,0 +1,134 @@ @@ -0,0 +1,134 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Tests.Utils;
using NUnit.Framework;
namespace ICSharpCode.SharpDevelop.Tests
{
/// <summary>
/// Tests the OverrideCompletionDataProvider GetOverridableProperties.
/// This property should be added to the IClass interface.
/// </summary>
[TestFixture]
public class OverridablePropertiesTestFixture
{
MockClass c;
MockDefaultReturnType returnType;
List<IProperty> expectedProperties;
MockClass declaringType;
[SetUp]
public void SetUp()
{
expectedProperties = new List<IProperty>();
c = new MockClass("MyClass");
declaringType = new MockClass("MyDeclaringType");
returnType = new MockDefaultReturnType();
c.DefaultReturnType = returnType;
}
/// <summary>
/// Add one overridable property to the return type and this
/// should be returned in the list of overridable properties.
/// </summary>
[Test]
public void OneOverridablePropertyReturned()
{
MockProperty property = new MockProperty("IsRunning");
property.DeclaringType = declaringType;
property.IsOverridable = true;
returnType.Properties.Add(property);
expectedProperties.Add(property);
IProperty[] properties = OverrideCompletionDataProvider.GetOverridableProperties(c);
AssertArePropertiesEqual(expectedProperties, properties);
}
/// <summary>
/// Make sure that an overridable property is not returned when
/// it is part of the class being considered.
/// </summary>
[Test]
public void OverridablePropertyPartOfClass()
{
MockProperty property = new MockProperty("IsRunning");
property.DeclaringType = c;
property.IsOverridable = true;
returnType.Properties.Add(property);
IProperty[] properties = OverrideCompletionDataProvider.GetOverridableProperties(c);
AssertArePropertiesEqual(expectedProperties, properties);
}
/// <summary>
/// An overridable but const property should not be returned.
/// </summary>
[Test]
public void OverridableConstPropertyNotReturned()
{
MockProperty property = new MockProperty("IsRunning");
property.DeclaringType = declaringType;
property.IsOverridable = true;
property.IsConst = true;
returnType.Properties.Add(property);
IProperty[] properties = OverrideCompletionDataProvider.GetOverridableProperties(c);
AssertArePropertiesEqual(expectedProperties, properties);
}
/// <summary>
/// An overridable but private property should not be returned.
/// </summary>
[Test]
public void OverridablePrivatePropertyNotReturned()
{
MockProperty property = new MockProperty("Run");
property.DeclaringType = declaringType;
property.IsOverridable = true;
property.IsPrivate = true;
returnType.Properties.Add(property);
IProperty[] properties = OverrideCompletionDataProvider.GetOverridableProperties(c);
AssertArePropertiesEqual(expectedProperties, properties);
}
[Test]
[ExpectedException(typeof(ArgumentException))]
public void NullArgument()
{
OverrideCompletionDataProvider.GetOverridableProperties(null);
}
void AssertArePropertiesEqual(List<IProperty> expectedProperties, IProperty[] properties)
{
// Get a list of expected property names.
List<string> expectedPropertyNames = new List<string>();
foreach (IProperty expectedProperty in expectedProperties) {
expectedPropertyNames.Add(expectedProperty.Name);
}
// Get a list of actual property names.
List<string> propertyNames = new List<string>();
foreach (IProperty p in properties) {
propertyNames.Add(p.Name);
}
// Compare the two arrays.
Assert.AreEqual(expectedPropertyNames.ToArray(), propertyNames.ToArray());
}
}
}

87
src/Main/Base/Test/Utils/MockAmbience.cs

@ -0,0 +1,87 @@ @@ -0,0 +1,87 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.SharpDevelop.Tests.Utils
{
/// <summary>
/// Mock Ambience class.
/// </summary>
public class MockAmbience : AbstractAmbience
{
public MockAmbience()
{
}
public override string Convert(ModifierEnum modifier)
{
return String.Empty;
}
public override string Convert(IClass c)
{
return String.Empty;
}
public override string ConvertEnd(IClass c)
{
return String.Empty;
}
public override string Convert(IField c)
{
return String.Empty;
}
public override string Convert(IProperty property)
{
return property.Name;
}
public override string Convert(IEvent e)
{
return String.Empty;
}
public override string Convert(IMethod m)
{
return m.Name;
}
public override string ConvertEnd(IMethod m)
{
return String.Empty;
}
public override string Convert(IParameter param)
{
return String.Empty;
}
public override string Convert(IReturnType returnType)
{
return String.Empty;
}
public override string WrapAttribute(string attribute)
{
return String.Empty;
}
public override string WrapComment(string comment)
{
return String.Empty;
}
public override string GetIntrinsicTypeName(string dotNetTypeName)
{
return String.Empty;
}
}
}

354
src/Main/Base/Test/Utils/MockClass.cs

@ -0,0 +1,354 @@ @@ -0,0 +1,354 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Dom;
using System;
using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Tests.Utils
{
/// <summary>
/// Dummy class that implements the IClass interface. The
/// only property this mock class implements is the DefaultReturnType
/// property.
/// </summary>
public class MockClass : IClass
{
IReturnType returnType;
string qualifiedName = String.Empty;
public MockClass(string qualifiedName)
{
this.qualifiedName = qualifiedName;
}
public string FullyQualifiedName {
get {
return qualifiedName;
}
set {
qualifiedName = value;
}
}
public IReturnType DefaultReturnType {
get {
return returnType;
}
set {
returnType = value;
}
}
public string DotNetName {
get {
throw new NotImplementedException();
}
}
public string Name {
get {
throw new NotImplementedException();
}
}
public string Namespace {
get {
throw new NotImplementedException();
}
}
public ClassType ClassType {
get {
throw new NotImplementedException();
}
}
public IProjectContent ProjectContent {
get {
throw new NotImplementedException();
}
}
public ICompilationUnit CompilationUnit {
get {
throw new NotImplementedException();
}
}
public DomRegion Region {
get {
throw new NotImplementedException();
}
}
public DomRegion BodyRegion {
get {
throw new NotImplementedException();
}
}
public List<IReturnType> BaseTypes {
get {
throw new NotImplementedException();
}
}
public List<IClass> InnerClasses {
get {
throw new NotImplementedException();
}
}
public List<IField> Fields {
get {
throw new NotImplementedException();
}
}
public List<IProperty> Properties {
get {
throw new NotImplementedException();
}
}
public List<IMethod> Methods {
get {
throw new NotImplementedException();
}
}
public List<IEvent> Events {
get {
throw new NotImplementedException();
}
}
public IList<ITypeParameter> TypeParameters {
get {
throw new NotImplementedException();
}
}
public IEnumerable<IClass> ClassInheritanceTree {
get {
throw new NotImplementedException();
}
}
public IClass BaseClass {
get {
throw new NotImplementedException();
}
}
public IReturnType BaseType {
get {
throw new NotImplementedException();
}
}
public bool HasPublicOrInternalStaticMembers {
get {
throw new NotImplementedException();
}
}
public bool HasExtensionMethods {
get {
throw new NotImplementedException();
}
}
public bool IsPartial {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public IClass DeclaringType {
get {
throw new NotImplementedException();
}
}
public ModifierEnum Modifiers {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public IList<IAttribute> Attributes {
get {
throw new NotImplementedException();
}
}
public string Documentation {
get {
throw new NotImplementedException();
}
}
public bool IsAbstract {
get {
throw new NotImplementedException();
}
}
public bool IsSealed {
get {
throw new NotImplementedException();
}
}
public bool IsStatic {
get {
throw new NotImplementedException();
}
}
public bool IsConst {
get {
throw new NotImplementedException();
}
}
public bool IsVirtual {
get {
throw new NotImplementedException();
}
}
public bool IsPublic {
get {
throw new NotImplementedException();
}
}
public bool IsProtected {
get {
throw new NotImplementedException();
}
}
public bool IsPrivate {
get {
throw new NotImplementedException();
}
}
public bool IsInternal {
get {
throw new NotImplementedException();
}
}
public bool IsReadonly {
get {
throw new NotImplementedException();
}
}
public bool IsProtectedAndInternal {
get {
throw new NotImplementedException();
}
}
public bool IsProtectedOrInternal {
get {
throw new NotImplementedException();
}
}
public bool IsOverride {
get {
throw new NotImplementedException();
}
}
public bool IsOverridable {
get {
throw new NotImplementedException();
}
}
public bool IsNew {
get {
throw new NotImplementedException();
}
}
public bool IsSynthetic {
get {
throw new NotImplementedException();
}
}
public object UserData {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public IReturnType GetBaseType(int index)
{
throw new NotImplementedException();
}
public IClass GetCompoundClass()
{
throw new NotImplementedException();
}
public IClass GetInnermostClass(int caretLine, int caretColumn)
{
throw new NotImplementedException();
}
public List<IClass> GetAccessibleTypes(IClass callingClass)
{
throw new NotImplementedException();
}
public IMember SearchMember(string memberName, LanguageProperties language)
{
throw new NotImplementedException();
}
public bool IsTypeInInheritanceTree(IClass possibleBaseClass)
{
throw new NotImplementedException();
}
public bool IsAccessible(IClass callingClass, bool isClassInInheritanceTree)
{
throw new NotImplementedException();
}
public bool MustBeShown(IClass callingClass, bool showStatic, bool isClassInInheritanceTree)
{
throw new NotImplementedException();
}
public int CompareTo(object obj)
{
throw new NotImplementedException();
}
}
}

25
src/Main/Base/Test/Utils/MockDecoration.cs

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.SharpDevelop.Tests.Utils
{
public class MockDecoration : AbstractDecoration
{
public MockDecoration() : base(null)
{
}
public override string DocumentationTag {
get {
return String.Empty;
}
}
}
}

137
src/Main/Base/Test/Utils/MockDefaultReturnType.cs

@ -0,0 +1,137 @@ @@ -0,0 +1,137 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Dom;
using System;
using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Tests.Utils
{
public class MockDefaultReturnType : IReturnType
{
List<IMethod> methods = new List<IMethod>();
List<IProperty> properties = new List<IProperty>();
public MockDefaultReturnType()
{
}
/// <summary>
/// Gets the method list directly. Only available in the
/// mock default return type class.
/// </summary>
public List<IMethod> Methods {
get {
return methods;
}
}
/// <summary>
/// Gets the property list directly. Only available in the
/// mock default return type class.
/// </summary>
public List<IProperty> Properties {
get {
return properties;
}
}
public string FullyQualifiedName {
get {
throw new NotImplementedException();
}
}
public string Name {
get {
throw new NotImplementedException();
}
}
public string Namespace {
get {
throw new NotImplementedException();
}
}
public string DotNetName {
get {
throw new NotImplementedException();
}
}
public int TypeParameterCount {
get {
throw new NotImplementedException();
}
}
public bool IsDefaultReturnType {
get {
throw new NotImplementedException();
}
}
public bool IsArrayReturnType {
get {
throw new NotImplementedException();
}
}
public bool IsGenericReturnType {
get {
throw new NotImplementedException();
}
}
public bool IsConstructedReturnType {
get {
throw new NotImplementedException();
}
}
public IClass GetUnderlyingClass()
{
throw new NotImplementedException();
}
public List<IMethod> GetMethods()
{
return methods;
}
public List<IProperty> GetProperties()
{
return properties;
}
public List<IField> GetFields()
{
throw new NotImplementedException();
}
public List<IEvent> GetEvents()
{
throw new NotImplementedException();
}
public ArrayReturnType CastToArrayReturnType()
{
throw new NotImplementedException();
}
public GenericReturnType CastToGenericReturnType()
{
throw new NotImplementedException();
}
public ConstructedReturnType CastToConstructedReturnType()
{
throw new NotImplementedException();
}
}
}

276
src/Main/Base/Test/Utils/MockMethod.cs

@ -0,0 +1,276 @@ @@ -0,0 +1,276 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.SharpDevelop.Tests.Utils
{
public class MockMethod : IMethod
{
string name = String.Empty;
bool overridable;
bool isConst;
bool isPrivate;
IClass declaringType;
public MockMethod(string name)
{
this.name = name;
}
public IList<ITypeParameter> TypeParameters {
get {
throw new NotImplementedException();
}
}
public bool IsConstructor {
get {
throw new NotImplementedException();
}
}
public IList<IParameter> Parameters {
get {
throw new NotImplementedException();
}
}
public bool IsExtensionMethod {
get {
throw new NotImplementedException();
}
}
public string FullyQualifiedName {
get {
throw new NotImplementedException();
}
}
public IReturnType DeclaringTypeReference {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public DomRegion Region {
get {
throw new NotImplementedException();
}
}
public string Name {
get {
return name;
}
}
public string Namespace {
get {
throw new NotImplementedException();
}
}
public string DotNetName {
get {
throw new NotImplementedException();
}
}
public IReturnType ReturnType {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public DomRegion BodyRegion {
get {
throw new NotImplementedException();
}
}
public IList<ExplicitInterfaceImplementation> InterfaceImplementations {
get {
throw new NotImplementedException();
}
}
public IClass DeclaringType {
get {
return declaringType;
}
set {
declaringType = value;
}
}
public ModifierEnum Modifiers {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public IList<IAttribute> Attributes {
get {
throw new NotImplementedException();
}
}
public string Documentation {
get {
throw new NotImplementedException();
}
}
public bool IsAbstract {
get {
throw new NotImplementedException();
}
}
public bool IsSealed {
get {
throw new NotImplementedException();
}
}
public bool IsStatic {
get {
throw new NotImplementedException();
}
}
public bool IsConst {
get {
return isConst;
}
set {
isConst = value;
}
}
public bool IsVirtual {
get {
throw new NotImplementedException();
}
}
public bool IsPublic {
get {
throw new NotImplementedException();
}
}
public bool IsProtected {
get {
throw new NotImplementedException();
}
}
public bool IsPrivate {
get {
return isPrivate;
}
set {
isPrivate = value;
}
}
public bool IsInternal {
get {
throw new NotImplementedException();
}
}
public bool IsReadonly {
get {
throw new NotImplementedException();
}
}
public bool IsProtectedAndInternal {
get {
throw new NotImplementedException();
}
}
public bool IsProtectedOrInternal {
get {
throw new NotImplementedException();
}
}
public bool IsOverride {
get {
throw new NotImplementedException();
}
}
public bool IsOverridable {
get {
return overridable;
}
set {
overridable = value;
}
}
public bool IsNew {
get {
throw new NotImplementedException();
}
}
public bool IsSynthetic {
get {
throw new NotImplementedException();
}
}
public object UserData {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public bool IsAccessible(IClass callingClass, bool isClassInInheritanceTree)
{
throw new NotImplementedException();
}
public bool MustBeShown(IClass callingClass, bool showStatic, bool isClassInInheritanceTree)
{
throw new NotImplementedException();
}
public int CompareTo(object obj)
{
throw new NotImplementedException();
}
public object Clone()
{
throw new NotImplementedException();
}
}
}

30
src/Main/Base/Test/Utils/MockProject.cs

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.CSharp;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.Tests.Utils
{
/// <summary>
/// Mocks IProject class that returns a dummy ambience.
/// </summary>
public class MockProject : AbstractProject
{
public MockProject()
{
}
public override IAmbience Ambience {
get {
return new MockAmbience();
}
}
}
}

294
src/Main/Base/Test/Utils/MockProperty.cs

@ -0,0 +1,294 @@ @@ -0,0 +1,294 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.SharpDevelop.Tests.Utils
{
public class MockProperty : IProperty
{
bool overridable;
bool isConst;
bool isPrivate;
IClass declaringType;
string name = String.Empty;
public MockProperty(string name)
{
this.name = name;
}
public DomRegion GetterRegion {
get {
throw new NotImplementedException();
}
}
public DomRegion SetterRegion {
get {
throw new NotImplementedException();
}
}
public bool CanGet {
get {
throw new NotImplementedException();
}
}
public bool CanSet {
get {
throw new NotImplementedException();
}
}
public bool IsIndexer {
get {
throw new NotImplementedException();
}
}
public IList<IParameter> Parameters {
get {
throw new NotImplementedException();
}
}
public bool IsExtensionMethod {
get {
throw new NotImplementedException();
}
}
public string FullyQualifiedName {
get {
throw new NotImplementedException();
}
}
public IReturnType DeclaringTypeReference {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public DomRegion Region {
get {
throw new NotImplementedException();
}
}
public string Name {
get {
return name;
}
}
public string Namespace {
get {
throw new NotImplementedException();
}
}
public string DotNetName {
get {
throw new NotImplementedException();
}
}
public IReturnType ReturnType {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public DomRegion BodyRegion {
get {
throw new NotImplementedException();
}
}
public IList<ExplicitInterfaceImplementation> InterfaceImplementations {
get {
throw new NotImplementedException();
}
}
public IClass DeclaringType {
get {
return declaringType;
}
set {
declaringType = value;
}
}
public ModifierEnum Modifiers {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public IList<IAttribute> Attributes {
get {
throw new NotImplementedException();
}
}
public string Documentation {
get {
throw new NotImplementedException();
}
}
public bool IsAbstract {
get {
throw new NotImplementedException();
}
}
public bool IsSealed {
get {
throw new NotImplementedException();
}
}
public bool IsStatic {
get {
throw new NotImplementedException();
}
}
public bool IsConst {
get {
return isConst;
}
set {
isConst = value;
}
}
public bool IsVirtual {
get {
throw new NotImplementedException();
}
}
public bool IsPublic {
get {
throw new NotImplementedException();
}
}
public bool IsProtected {
get {
throw new NotImplementedException();
}
}
public bool IsPrivate {
get {
return isPrivate;
}
set {
isPrivate = value;
}
}
public bool IsInternal {
get {
throw new NotImplementedException();
}
}
public bool IsReadonly {
get {
throw new NotImplementedException();
}
}
public bool IsProtectedAndInternal {
get {
throw new NotImplementedException();
}
}
public bool IsProtectedOrInternal {
get {
throw new NotImplementedException();
}
}
public bool IsOverride {
get {
throw new NotImplementedException();
}
}
public bool IsOverridable {
get {
return overridable;
}
set {
overridable = value;
}
}
public bool IsNew {
get {
throw new NotImplementedException();
}
}
public bool IsSynthetic {
get {
throw new NotImplementedException();
}
}
public object UserData {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public bool IsAccessible(IClass callingClass, bool isClassInInheritanceTree)
{
throw new NotImplementedException();
}
public bool MustBeShown(IClass callingClass, bool showStatic, bool isClassInInheritanceTree)
{
throw new NotImplementedException();
}
public int CompareTo(object obj)
{
throw new NotImplementedException();
}
public object Clone()
{
throw new NotImplementedException();
}
}
}

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

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

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

@ -65,6 +65,9 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer @@ -65,6 +65,9 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer
if (methodBase.IsAbstract) {
modifiers |= ModifierEnum.Abstract;
}
if (methodBase.IsFinal) {
modifiers |= ModifierEnum.Sealed;
}
this.Modifiers = modifiers;
}
}

4
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionProperty.cs

@ -71,7 +71,9 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer @@ -71,7 +71,9 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer
if (methodBase.IsAbstract) {
modifiers |= ModifierEnum.Abstract;
}
if (methodBase.IsFinal) {
modifiers |= ModifierEnum.Sealed;
}
} else { // assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public;
}

Loading…
Cancel
Save