Browse Source

Fixed decompilation of "catch{}" blocks (catch without exception type)

pull/124/head
Daniel Grunwald 15 years ago
parent
commit
00c4ccb7a1
  1. 6
      ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

6
ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

@ -160,6 +160,11 @@ namespace ICSharpCode.Decompiler.Ast @@ -160,6 +160,11 @@ namespace ICSharpCode.Decompiler.Ast
var tryCatchStmt = new Ast.TryCatchStatement();
tryCatchStmt.TryBlock = TransformBlock(tryCatchNode.TryBlock);
foreach (var catchClause in tryCatchNode.CatchBlocks) {
if (catchClause.ExceptionVariable == null
&& (catchClause.ExceptionType == null || catchClause.ExceptionType.MetadataType == MetadataType.Object))
{
tryCatchStmt.CatchClauses.Add(new Ast.CatchClause { Body = TransformBlock(catchClause) });
} else {
tryCatchStmt.CatchClauses.Add(
new Ast.CatchClause {
Type = AstBuilder.ConvertType(catchClause.ExceptionType),
@ -167,6 +172,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -167,6 +172,7 @@ namespace ICSharpCode.Decompiler.Ast
Body = TransformBlock(catchClause)
});
}
}
if (tryCatchNode.FinallyBlock != null)
tryCatchStmt.FinallyBlock = TransformBlock(tryCatchNode.FinallyBlock);
if (tryCatchNode.FaultBlock != null) {

Loading…
Cancel
Save