From b83553d64c35829a0970d92963241244e082b293 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 29 Nov 2010 17:07:14 +0100 Subject: [PATCH] fixed http://community.sharpdevelop.net/forums/t/12320.aspx --- .../Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs index f4d8d8b7f9..ac9c05394a 100644 --- a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs @@ -1956,12 +1956,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter else TrackVisit(forNextStatement.LoopVariableExpression, data); outputFormatter.Space(); - PrimitiveExpression pe = forNextStatement.Step as PrimitiveExpression; + Expression stepExpr = forNextStatement.Step; + while (stepExpr is ParenthesizedExpression) + stepExpr = ((ParenthesizedExpression)stepExpr).Expression; + PrimitiveExpression pe = stepExpr as PrimitiveExpression; if ((pe == null || !(pe.Value is int) || ((int)pe.Value) >= 0) - && !(forNextStatement.Step is UnaryOperatorExpression)) + && !(stepExpr is UnaryOperatorExpression)) outputFormatter.PrintToken(Tokens.LessEqual); else { - if (forNextStatement.Step is UnaryOperatorExpression && ((UnaryOperatorExpression)forNextStatement.Step).Op == UnaryOperatorType.Plus) + if (stepExpr is UnaryOperatorExpression && ((UnaryOperatorExpression)stepExpr).Op == UnaryOperatorType.Plus) outputFormatter.PrintToken(Tokens.LessEqual); else outputFormatter.PrintToken(Tokens.GreaterEqual);