Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/NRefactory.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ICSharpCode.NRefactory.CSharp/OutputVisitor/InsertParenthesesVisitor.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/ICSharpCode.NRefactory.CSharp/OutputVisitor/InsertParenthesesVisitor.cs b/ICSharpCode.NRefactory.CSharp/OutputVisitor/InsertParenthesesVisitor.cs
index 4528a5f9..475ca40b 100644
--- a/ICSharpCode.NRefactory.CSharp/OutputVisitor/InsertParenthesesVisitor.cs
+++ b/ICSharpCode.NRefactory.CSharp/OutputVisitor/InsertParenthesesVisitor.cs
@@ -63,6 +63,13 @@ namespace ICSharpCode.NRefactory.CSharp
}
if (expr is CastExpression)
return Unary;
+ if (expr is PrimitiveExpression) {
+ var value = ((PrimitiveExpression)expr).Value;
+ if (value is int && (int)value < 0)
+ return Unary;
+ if (value is long && (long)value < 0)
+ return Unary;
+ }
BinaryOperatorExpression boe = expr as BinaryOperatorExpression;
if (boe != null) {
switch (boe.Operator) {