|
|
@ -28,12 +28,28 @@ namespace Decompiler.Transforms.Ast |
|
|
|
return base.VisitAssignmentExpression(assignmentExpression, data); |
|
|
|
return base.VisitAssignmentExpression(assignmentExpression, data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override object VisitArrayCreateExpression(ArrayCreateExpression array, object data) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
for(int i = 0; i < array.Arguments.Count; i++) { |
|
|
|
|
|
|
|
array.Arguments[i] = Deparenthesize(array.Arguments[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return base.VisitArrayCreateExpression(array, data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override object VisitReturnStatement(ReturnStatement returnStatement, object data) |
|
|
|
public override object VisitReturnStatement(ReturnStatement returnStatement, object data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
returnStatement.Expression = Deparenthesize(returnStatement.Expression); |
|
|
|
returnStatement.Expression = Deparenthesize(returnStatement.Expression); |
|
|
|
return base.VisitReturnStatement(returnStatement, data); |
|
|
|
return base.VisitReturnStatement(returnStatement, data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override object VisitCastExpression(CastExpression castExpression, object data) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (GetPrecedence(castExpression.Expression) > GetPrecedence(castExpression)) { |
|
|
|
|
|
|
|
castExpression.Expression = Deparenthesize(castExpression.Expression); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return base.VisitCastExpression(castExpression, data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override object VisitIndexerExpression(IndexerExpression indexer, object data) |
|
|
|
public override object VisitIndexerExpression(IndexerExpression indexer, object data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (GetPrecedence(indexer.TargetObject) >= GetPrecedence(indexer)) { |
|
|
|
if (GetPrecedence(indexer.TargetObject) >= GetPrecedence(indexer)) { |
|
|
@ -166,6 +182,7 @@ namespace Decompiler.Transforms.Ast |
|
|
|
// --x
|
|
|
|
// --x
|
|
|
|
if (unary != null && unary.Op == UnaryOperatorType.Decrement) return 14; |
|
|
|
if (unary != null && unary.Op == UnaryOperatorType.Decrement) return 14; |
|
|
|
// (T)x
|
|
|
|
// (T)x
|
|
|
|
|
|
|
|
if (expr is CastExpression) return 14; |
|
|
|
// Multiplicative
|
|
|
|
// Multiplicative
|
|
|
|
// *, ,
|
|
|
|
// *, ,
|
|
|
|
if (binary != null && binary.Op == BinaryOperatorType.Multiply) return 13; |
|
|
|
if (binary != null && binary.Op == BinaryOperatorType.Multiply) return 13; |
|
|
|