Esempio n. 1
0
 public override ICodeNode VisitMethodReferenceExpression(MethodReferenceExpression node)
 {
     V_0 = node.get_Method().Resolve();
     V_1 = this.context.get_TypeContext().get_CurrentType();
     if (V_0 == null || (object)V_0.get_DeclaringType() != (object)V_1 && !V_0.get_DeclaringType().IsNestedIn(V_1))
     {
         return(this.VisitMethodReferenceExpression(node));
     }
     if (V_0.get_IsGetter() || V_0.get_IsSetter() || !V_0.IsCompilerGenerated(true) && !this.CheckTypeForCompilerGeneratedAttribute(V_0.get_DeclaringType()))
     {
         return(this.VisitMethodReferenceExpression(node));
     }
     V_2 = null;
     if (V_0.get_Body() != null)
     {
         V_5 = this.CreateDecompilationContext(V_0);
         V_2 = V_0.get_Body().DecompileLambda(this.context.get_Language(), V_5);
         if (V_2.get_Statements().get_Count() == 1 && V_2.get_Statements().get_Item(0).get_CodeNodeType() == 5 && (V_2.get_Statements().get_Item(0) as ExpressionStatement).get_Expression().get_CodeNodeType() == 57)
         {
             V_6 = (V_2.get_Statements().get_Item(0) as ExpressionStatement).get_Expression() as ReturnExpression;
             V_7 = new ShortFormReturnExpression(V_6.get_Value(), V_6.get_MappedInstructions());
             V_2 = new BlockStatement();
             V_2.get_Statements().Add(new ExpressionStatement(V_7));
         }
         this.context.get_MethodContext().get_VariableDefinitionToNameMap().AddRange <VariableDefinition, string>(V_5.get_MethodContext().get_VariableDefinitionToNameMap());
         this.context.get_MethodContext().get_VariableNamesCollection().UnionWith(V_5.get_MethodContext().get_VariableNamesCollection());
         this.context.get_MethodContext().AddInnerMethodParametersToContext(V_5.get_MethodContext());
         this.context.get_MethodContext().get_GotoStatements().AddRange(V_5.get_MethodContext().get_GotoStatements());
         this.context.get_MethodContext().get_GotoLabels().AddRange <string, Statement>(V_5.get_MethodContext().get_GotoLabels());
     }
     V_3 = new ExpressionCollection();
     V_4 = LambdaExpressionsHelper.HasAnonymousParameter(V_0.get_Parameters());
     V_8 = V_0.get_Parameters().GetEnumerator();
     try
     {
         while (V_8.MoveNext())
         {
             V_9 = V_8.get_Current();
             V_3.Add(new LambdaParameterExpression(V_9, !V_4, null));
         }
     }
     finally
     {
         V_8.Dispose();
     }
     return(new LambdaExpression(V_3, V_2, V_0.IsAsync(), V_0.IsFunction(), node.get_Method().get_Parameters(), false, node.get_MappedInstructions()));
 }