Browse Source

Ignore redundant 'this' in constructors.

newNRvisualizers
Daniel Grunwald 13 years ago
parent
commit
e83d77a885
  1. 13
      ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantThisIssue.cs

13
ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantThisIssue.cs

@ -45,6 +45,12 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring @@ -45,6 +45,12 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
IssueMarker = IssueMarker.GrayOut)]
public class RedundantThisIssue : ICodeIssueProvider
{
/// <summary>
/// Specifies whether to ignore redundant 'this' in constructors.
/// "this.Name = name;"
/// </summary>
public bool IgnoreConstructors = true;
public IEnumerable<CodeIssue> GetIssues(BaseRefactoringContext context)
{
return new GatherVisitor(context, this).GetIssues();
@ -69,6 +75,13 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring @@ -69,6 +75,13 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring
return null;
}
public override void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration)
{
if (inspector.IgnoreConstructors)
return;
base.VisitConstructorDeclaration(constructorDeclaration);
}
public override void VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression)
{

Loading…
Cancel
Save