Browse Source

Fixed decompiler crashes.

pull/124/head
Daniel Grunwald 14 years ago
parent
commit
a59462a2c8
  1. 11
      ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
  2. 2
      ICSharpCode.Decompiler/Ast/TypesHierarchyHelpers.cs

11
ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

@ -344,8 +344,9 @@ namespace ICSharpCode.Decompiler.Ast @@ -344,8 +344,9 @@ namespace ICSharpCode.Decompiler.Ast
return new Ast.AssignmentExpression(arg1.Indexer(arg2), arg3);
case ILCode.CompoundAssignment:
{
BinaryOperatorExpression boe = (BinaryOperatorExpression)arg1;
return new Ast.AssignmentExpression {
CastExpression cast = arg1 as CastExpression;
BinaryOperatorExpression boe = (BinaryOperatorExpression)(cast != null ? cast.Expression : arg1);
var assignment = new Ast.AssignmentExpression {
Left = boe.Left.Detach(),
Operator = ReplaceMethodCallsWithOperators.GetAssignmentOperatorForBinaryOperator(boe.Operator),
Right = boe.Right.Detach()
@ -353,6 +354,12 @@ namespace ICSharpCode.Decompiler.Ast @@ -353,6 +354,12 @@ namespace ICSharpCode.Decompiler.Ast
// We do not mark the resulting assignment as RestoreOriginalAssignOperatorAnnotation, because
// the operator cannot be translated back to the expanded form (as the left-hand expression
// would be evaluated twice, and might have side-effects)
if (cast != null) {
cast.Expression = assignment;
return cast;
} else {
return assignment;
}
}
#endregion
#region Comparison

2
ICSharpCode.Decompiler/Ast/TypesHierarchyHelpers.cs

@ -167,6 +167,8 @@ namespace ICSharpCode.Decompiler.Ast @@ -167,6 +167,8 @@ namespace ICSharpCode.Decompiler.Ast
{
if (tr1 == tr2)
return true;
if (tr1 == null || tr2 == null)
return false;
if (tr1.Name == tr2.Name && tr1.FullName == tr2.FullName)
return true;

Loading…
Cancel
Save