diff options
Diffstat (limited to 'ICSharpCode.NRefactory.CSharp')
-rw-r--r-- | ICSharpCode.NRefactory.CSharp/OutputVisitor/InsertParenthesesVisitor.cs | 7 |
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) { |