|
|
|
@ -52,6 +52,8 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring |
|
|
|
|
|
|
|
|
|
|
|
public override void VisitVariableInitializer (VariableInitializer variableInitializer) |
|
|
|
public override void VisitVariableInitializer (VariableInitializer variableInitializer) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
base.VisitVariableInitializer (variableInitializer); |
|
|
|
|
|
|
|
|
|
|
|
// check if variable is assigned
|
|
|
|
// check if variable is assigned
|
|
|
|
if (!variableInitializer.Initializer.IsNull) |
|
|
|
if (!variableInitializer.Initializer.IsNull) |
|
|
|
return; |
|
|
|
return; |
|
|
|
@ -78,11 +80,12 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring |
|
|
|
script.Replace (decl, newDeclaration); |
|
|
|
script.Replace (decl, newDeclaration); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
base.VisitVariableInitializer (variableInitializer); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override void VisitForeachStatement (ForeachStatement foreachStatement) |
|
|
|
public override void VisitForeachStatement (ForeachStatement foreachStatement) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
base.VisitForeachStatement (foreachStatement); |
|
|
|
|
|
|
|
|
|
|
|
var resolveResult = ctx.Resolve (foreachStatement.VariableNameToken) as LocalResolveResult; |
|
|
|
var resolveResult = ctx.Resolve (foreachStatement.VariableNameToken) as LocalResolveResult; |
|
|
|
if (resolveResult == null) |
|
|
|
if (resolveResult == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
@ -91,8 +94,6 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
AddIssue (foreachStatement.VariableNameToken, ctx.TranslateString ("Local variable is never used")); |
|
|
|
AddIssue (foreachStatement.VariableNameToken, ctx.TranslateString ("Local variable is never used")); |
|
|
|
|
|
|
|
|
|
|
|
base.VisitForeachStatement (foreachStatement); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|