From 90c1b11416465dfed3ca030ae22a473059f726b1 Mon Sep 17 00:00:00 2001 From: Mansheng Yang Date: Sat, 21 Jul 2012 23:12:04 +0800 Subject: [PATCH] [CodeIssue] ConstantConditionIssue: use 'true'/'false' instead of 'True'/'False' in title --- .../Refactoring/CodeIssues/ConstantConditionIssue.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs index f441b4921c..8ebdb90330 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/ConstantConditionIssue.cs @@ -94,12 +94,14 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring var value = (bool)resolveResult.ConstantValue; var conditionalExpr = condition.Parent as ConditionalExpression; var ifElseStatement = condition.Parent as IfElseStatement; + var valueStr = value.ToString ().ToLower (); + if (conditionalExpr != null) { var replaceExpr = value ? conditionalExpr.TrueExpression : conditionalExpr.FalseExpression; - AddIssue (condition, ctx.TranslateString ("Replace '?:' with '" + value + "' branch"), + AddIssue (condition, ctx.TranslateString ("Replace '?:' with '" + valueStr + "' branch"), script => script.Replace (conditionalExpr, replaceExpr.Clone ())); } else if (ifElseStatement != null) { - AddIssue (condition, ctx.TranslateString ("Replace 'if' with '" + value + "' branch"), + AddIssue (condition, ctx.TranslateString ("Replace 'if' with '" + valueStr + "' branch"), script => { var statement = value ? ifElseStatement.TrueStatement : ifElseStatement.FalseStatement; var blockStatement = statement as BlockStatement; @@ -121,7 +123,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring script.FormatText (ifElseStatement.Parent); }); } else { - AddIssue (condition, ctx.TranslateString ("Replace expression with '" + value + "'"), + AddIssue (condition, ctx.TranslateString ("Replace expression with '" + valueStr + "'"), script => script.Replace (condition, new PrimitiveExpression (value))); } }