public override ICodeNode VisitCatchClause(CatchClause node)
 {
     node.set_Body((BlockStatement)this.Visit(node.get_Body()));
     if (node.get_Filter() == null || node.get_Filter() as BlockStatement == null)
     {
         return(node);
     }
     this.currentCatchClause = node;
     node.set_Filter((Statement)this.Visit(node.get_Filter()));
     this.currentCatchClause = null;
     stackVariable27         = CatchClausesFilterPattern.TryMatch(node.get_Filter() as BlockStatement, out V_0, out V_1);
     if (!stackVariable27)
     {
         if (V_0 == null || String.op_Equality(V_0.get_ExpressionType().get_FullName(), "System.Object") || !CatchClausesFilterPattern.TryMatchMethodStructure(node.get_Filter() as BlockStatement))
         {
             throw new NotSupportedException("Unsupported structure of filter clause.");
         }
         this.CreateMethod(node, V_0, out V_1);
     }
     dummyVar0 = this.context.get_MethodContext().get_VariablesToNotDeclare().Add(V_0.get_Variable());
     if (!stackVariable27)
     {
         node.set_Variable(V_0.CloneExpressionOnly() as VariableDeclarationExpression);
     }
     else
     {
         node.set_Variable(V_0);
     }
     node.set_Type(V_0.get_ExpressionType());
     node.set_Filter(new ExpressionStatement(V_1));
     return(node);
 }
 public override ICodeNode VisitCatchClause(CatchClause node)
 {
     if (node.get_Filter() == null || !this.context.get_Language().get_SupportsExceptionFilters())
     {
         return(this.VisitCatchClause(node));
     }
     this.isInFilter = true;
     node.set_Filter((Statement)this.Visit(node.get_Filter()));
     this.isInFilter = false;
     node.set_Body((BlockStatement)this.Visit(node.get_Body()));
     return(node);
 }
Beispiel #3
0
 public virtual void VisitCatchClause(CatchClause node)
 {
     this.Visit(node.get_Body());
     this.Visit(node.get_Variable());
     this.Visit(node.get_Filter());
     return;
 }
 private void CreateMethod(CatchClause catchClause, VariableDeclarationExpression variable, out Expression methodInvocationExpression)
 {
     methodInvocationExpression = null;
     stackVariable4             = catchClause.get_Filter() as BlockStatement;
     V_0 = (((stackVariable4.get_Statements().First <Statement>() as ExpressionStatement).get_Expression() as BinaryExpression).get_Right() as SafeCastExpression).get_Expression() as VariableReferenceExpression;
     V_0.set_Variable(variable.get_Variable());
     V_1 = stackVariable4.get_Statements().Last <Statement>() as ExpressionStatement;
     V_1.set_Expression(new ReturnExpression(V_1.get_Expression(), V_1.get_Expression().get_MappedInstructions()));
     V_2 = this.context.get_TypeContext().get_GeneratedFilterMethods().get_Count() + this.methodsToBeDecompiled.get_Count();
     V_3 = new MethodDefinition(String.Format("JustDecompileGenerated_Filter_{0}", V_2), 1, this.context.get_MethodContext().get_Method().get_Module().get_TypeSystem().get_Boolean());
     V_3.set_Body(new MethodBody(V_3));
     V_3.set_MetadataToken(new MetadataToken(0x6000000, 0xffffff - V_2));
     V_3.set_IsStatic(this.context.get_MethodContext().get_Method().get_IsStatic());
     V_3.set_HasThis(!V_3.get_IsStatic());
     V_3.set_DeclaringType(this.context.get_MethodContext().get_Method().get_DeclaringType());
     V_3.set_SemanticsAttributes(0);
     V_3.set_IsJustDecompileGenerated(true);
     V_4 = new DecompilationContext(this.CloneAndReplaceMethodBody(this.context.get_MethodContext(), V_3.get_Body()), this.context.get_TypeContext(), this.context.get_Language());
     V_5 = V_0.get_Variable().Resolve();
     if (V_4.get_MethodContext().get_VariableDefinitionToNameMap().ContainsKey(V_5))
     {
         V_4.get_MethodContext().get_VariableDefinitionToNameMap().Add(V_5, "JustDecompileGenerated_Exception");
     }
     else
     {
         V_4.get_MethodContext().get_VariableDefinitionToNameMap().set_Item(V_5, "JustDecompileGenerated_Exception");
     }
     dummyVar0 = V_4.get_MethodContext().get_VariablesToNotDeclare().Add(variable.get_Variable());
     this.methodsToBeDecompiled.Add(new FilterMethodToBeDecompiled(V_3, catchClause, V_4, catchClause.get_Filter() as BlockStatement));
     V_6 = this.AddAllParameters(catchClause, V_3, variable);
     methodInvocationExpression = this.CreateMethodInvocation(V_3, V_6);
     return;
 }
 public virtual ICodeNode VisitCatchClause(CatchClause node)
 {
     node.set_Body((BlockStatement)this.Visit(node.get_Body()));
     node.set_Variable((VariableDeclarationExpression)this.Visit(node.get_Variable()));
     node.set_Filter((Statement)this.Visit(node.get_Filter()));
     return(node);
 }