Browse Source

Fixed code completion for inner classes inside partial classes.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2977 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
1eb1023d74
  1. 55
      src/Main/Base/Test/InnerClassesResolverTests.cs
  2. 2
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/CompoundClass.cs
  3. 4
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ProjectContent/IProjectContent.cs

55
src/Main/Base/Test/InnerClassesResolverTests.cs

@ -61,6 +61,61 @@ class A {
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName); Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
} }
[Test]
public void InnerClassWithStaticFieldOfSameType()
{
string program = @"class A {
void Test() {
}
class B {
public static B Instance;
}
}
";
ResolveResult result = Resolve(program, "B.Instance", 3);
Assert.IsTrue(result is MemberResolveResult);
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
}
[Test]
public void InnerClassWithStaticFieldOfSameTypeInPartialClass1()
{
string program = @"partial class A {
void Test() {
}
}
partial class A {
class B {
public static B Instance;
}
}
";
ResolveResult result = Resolve(program, "B.Instance", 3);
Assert.IsTrue(result is MemberResolveResult);
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
}
[Test]
public void InnerClassWithStaticFieldOfSameTypeInPartialClass2()
{
string program = @"partial class A {
void Test() {
}
class B {
public static B Instance;
}
}
partial class A {
}
";
ResolveResult result = Resolve(program, "B.Instance", 3);
Assert.IsTrue(result is MemberResolveResult);
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
}
[Test] [Test]
public void ReflectionInnerClass() public void ReflectionInnerClass()
{ {

2
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/CompoundClass.cs

@ -74,6 +74,7 @@ namespace ICSharpCode.SharpDevelop.Dom
const ModifierEnum defaultClassVisibility = ModifierEnum.Internal; const ModifierEnum defaultClassVisibility = ModifierEnum.Internal;
this.BaseTypes.Clear(); this.BaseTypes.Clear();
this.InnerClasses.Clear();
this.Attributes.Clear(); this.Attributes.Clear();
this.Methods.Clear(); this.Methods.Clear();
this.Properties.Clear(); this.Properties.Clear();
@ -100,6 +101,7 @@ namespace ICSharpCode.SharpDevelop.Dom
this.BaseTypes.Add(rt); this.BaseTypes.Add(rt);
} }
} }
this.InnerClasses.AddRange(part.InnerClasses);
this.Attributes.AddRange(part.Attributes); this.Attributes.AddRange(part.Attributes);
this.Methods.AddRange(part.Methods); this.Methods.AddRange(part.Methods);
this.Properties.AddRange(part.Properties); this.Properties.AddRange(part.Properties);

4
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ProjectContent/IProjectContent.cs

@ -128,7 +128,7 @@ namespace ICSharpCode.SharpDevelop.Dom
this.Name = name; this.Name = name;
this.TypeParameterCount = typeParameterCount; this.TypeParameterCount = typeParameterCount;
this.CurrentCompilationUnit = currentType.CompilationUnit; this.CurrentCompilationUnit = currentType.CompilationUnit;
this.CurrentType = currentType; this.CurrentType = currentType != null ? currentType.GetCompoundClass() : null;
this.CaretLine = caretLine; this.CaretLine = caretLine;
this.CaretColumn = caretColumn; this.CaretColumn = caretColumn;
} }
@ -140,7 +140,7 @@ namespace ICSharpCode.SharpDevelop.Dom
this.Name = name; this.Name = name;
this.TypeParameterCount = typeParameterCount; this.TypeParameterCount = typeParameterCount;
this.CurrentCompilationUnit = currentCompilationUnit; this.CurrentCompilationUnit = currentCompilationUnit;
this.CurrentType = currentType; this.CurrentType = currentType != null ? currentType.GetCompoundClass() : null;
this.CaretLine = caretLine; this.CaretLine = caretLine;
this.CaretColumn = caretColumn; this.CaretColumn = caretColumn;
} }

Loading…
Cancel
Save