コード例 #1
0
 public override ICodeNode VisitObjectCreationExpression(ObjectCreationExpression node)
 {
     if (this.state != 2 || node.get_Arguments() == null || node.get_Arguments().get_Count() != 2 || node.get_Arguments().get_Item(0).get_CodeNodeType() != 26 || node.get_Arguments().get_Item(1).get_CodeNodeType() != 20 || !this.delegateCopies.Contains((node.get_Arguments().get_Item(0) as VariableReferenceExpression).get_Variable()))
     {
         return(this.VisitObjectCreationExpression(node));
     }
     V_0 = node.get_Constructor().get_DeclaringType().Resolve();
     if (V_0 == null || V_0.get_BaseType() == null || String.op_Inequality(V_0.get_BaseType().get_FullName(), "System.MulticastDelegate"))
     {
         return(this.VisitObjectCreationExpression(node));
     }
     V_1             = (node.get_Arguments().get_Item(1) as MethodReferenceExpression).get_Method();
     V_2             = (node.get_Arguments().get_Item(1) as MethodReferenceExpression).get_MethodDefinition();
     stackVariable62 = new MethodSpecificContext(V_2.get_Body());
     V_3             = new DecompilationContext(stackVariable62, this.context.get_TypeContext(), this.context.get_ModuleContext(), this.context.get_AssemblyContext(), this.context.get_Language());
     stackVariable62.set_FieldToExpression(this.fieldDefToAssignedValueMap);
     V_4 = V_2.get_Body().DecompileLambda(this.context.get_Language(), V_3);
     if (V_4.get_Statements().get_Count() == 1 && V_4.get_Statements().get_Item(0).get_CodeNodeType() == 5 && (V_4.get_Statements().get_Item(0) as ExpressionStatement).get_Expression().get_CodeNodeType() == 57)
     {
         V_8 = (V_4.get_Statements().get_Item(0) as ExpressionStatement).get_Expression() as ReturnExpression;
         V_9 = new ShortFormReturnExpression(V_8.get_Value(), V_8.get_MappedInstructions());
         V_4 = new BlockStatement();
         V_4.get_Statements().Add(new ExpressionStatement(V_9));
     }
     this.context.get_MethodContext().get_VariableDefinitionToNameMap().AddRange <VariableDefinition, string>(V_3.get_MethodContext().get_VariableDefinitionToNameMap());
     this.context.get_MethodContext().get_VariableNamesCollection().UnionWith(V_3.get_MethodContext().get_VariableNamesCollection());
     this.context.get_MethodContext().AddInnerMethodParametersToContext(V_3.get_MethodContext());
     this.context.get_MethodContext().get_GotoStatements().AddRange(V_3.get_MethodContext().get_GotoStatements());
     this.context.get_MethodContext().get_GotoLabels().AddRange <string, Statement>(V_3.get_MethodContext().get_GotoLabels());
     V_5  = new ExpressionCollection();
     V_6  = LambdaExpressionsHelper.HasAnonymousParameter(V_2.get_Parameters());
     V_10 = V_2.get_Parameters().GetEnumerator();
     try
     {
         while (V_10.MoveNext())
         {
             V_11 = V_10.get_Current();
             V_5.Add(new LambdaParameterExpression(V_11, !V_6, null));
         }
     }
     finally
     {
         V_10.Dispose();
     }
     this.delegatesFound.Add(V_4);
     stackVariable157 = new LambdaExpression(V_5, V_4, V_2.IsAsync(), V_2.IsFunction(), V_1.get_Parameters(), false, node.get_Arguments().get_Item(1).get_MappedInstructions());
     stackVariable157.set_ExpressionType(V_0);
     V_7 = stackVariable157;
     return(new DelegateCreationExpression(node.get_Constructor().get_DeclaringType(), V_7, node.get_Arguments().get_Item(0), node.get_MappedInstructions()));
 }