Fixed some code issue checks in partial classes.
This commit is contained in:
Родитель
8e2a8d59d4
Коммит
3c53080dee
|
@ -65,6 +65,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
|
|||
|
||||
public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
|
||||
{
|
||||
if (typeDeclaration.HasModifier(Modifiers.Partial))
|
||||
return;
|
||||
var list = new List<Tuple<VariableInitializer, IVariable>>();
|
||||
fieldStack.Push(list);
|
||||
|
||||
|
|
|
@ -92,6 +92,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
|
|||
|
||||
public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
|
||||
{
|
||||
if (typeDeclaration.HasModifier(Modifiers.Partial))
|
||||
return;
|
||||
var list = new List<Tuple<VariableInitializer, IVariable>>();
|
||||
fieldStack.Push(list);
|
||||
foreach (var fieldDeclaration in ConvertToConstantIssue.CollectFields(this, typeDeclaration)) {
|
||||
|
|
|
@ -78,6 +78,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
|
|||
|
||||
public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
|
||||
{
|
||||
if (typeDeclaration.HasModifier(Modifiers.Partial))
|
||||
return;
|
||||
var list = new List<Tuple<VariableInitializer, IVariable, VariableState>>();
|
||||
fieldStack.Push(list);
|
||||
|
||||
|
|
|
@ -110,6 +110,18 @@ namespace ICSharpCode.NRefactory.CSharp.CodeIssues
|
|||
}
|
||||
}");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPartial ()
|
||||
{
|
||||
TestWrongContext<CS0169FieldIsNeverUsedIssue>(@"partial class Test
|
||||
{
|
||||
object fooBar;
|
||||
}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -223,6 +223,18 @@ struct MutableStruct {
|
|||
}");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPartial ()
|
||||
{
|
||||
TestWrongContext<FieldCanBeMadeReadOnlyIssue>(@"partial class Test
|
||||
{
|
||||
object fooBar = new object ();
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
Console.WriteLine (fooBar);
|
||||
}
|
||||
}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,15 @@ public class FooBar
|
|||
}
|
||||
");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPartial ()
|
||||
{
|
||||
TestWrongContext<UnassignedReadonlyFieldIssue>(@"partial class Test
|
||||
{
|
||||
readonly object fooBar;
|
||||
}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\..\cecil\Test\libs\nunit-2.5.10\nunit.framework.dll</HintPath>
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -683,5 +683,6 @@
|
|||
<None Include="IndentationTests\TestFiles\CSharpParser.cs" />
|
||||
<None Include="IndentationTests\TestFiles\TextArea.cs" />
|
||||
<None Include="IndentationTests\TestFiles\InheritStatements.cs" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net40" />
|
||||
</packages>
|
Загрузка…
Ссылка в новой задаче