Ejemplo n.º 1
0
 public static BlockStatement CreateMethodBody(MethodDefinition methodDef, DecompilerContext context)
 {
     MethodDefinition oldCurrentMethod = context.CurrentMethod;
     Debug.Assert(oldCurrentMethod == null || oldCurrentMethod == methodDef);
     context.CurrentMethod = methodDef;
     try {
         AstMethodBodyBuilder builder = new AstMethodBodyBuilder();
         builder.methodDef = methodDef;
         builder.context = context;
         builder.typeSystem = methodDef.Module.TypeSystem;
         if (Debugger.IsAttached) {
             return builder.CreateMethodBody();
         } else {
             try {
                 return builder.CreateMethodBody();
             } catch (OperationCanceledException) {
                 throw;
             } catch (Exception ex) {
                 throw new ICSharpCode.Decompiler.DecompilerException(methodDef, ex);
             }
         }
     } finally {
         context.CurrentMethod = oldCurrentMethod;
     }
 }
Ejemplo n.º 2
0
 public static BlockStatement CreateMethodBody(MethodDefinition methodDef)
 {
     AstMethodBodyBuilder builder = new AstMethodBodyBuilder();
     builder.methodDef = methodDef;
     if (Debugger.IsAttached) {
         return builder.CreateMethodBody();
     } else {
         try {
             return builder.CreateMethodBody();
         } catch (OperationCanceledException) {
             throw;
         } catch (Exception ex) {
             throw new ICSharpCode.Decompiler.DecompilerException(methodDef, ex);
         }
     }
 }