Ejemplo n.º 1
0
 private HashSet <ILogicalConstruct> BuildLoop(DFSTree tree, out HashSet <ILogicalConstruct> loopBody)
 {
     loopBody = new HashSet <ILogicalConstruct>();
     V_0      = new HashSet <ILogicalConstruct>();
     V_1      = tree.get_BackEdges().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current();
             V_3 = V_2.get_End().get_Construct() as ILogicalConstruct;
             V_4 = V_2.get_Start().get_Construct() as ILogicalConstruct;
             if (this.removedEdges.ContainsKey(V_4) && this.removedEdges.get_Item(V_4).Contains(V_3))
             {
                 continue;
             }
             V_5 = tree.GetPath(V_2.get_End(), V_2.get_Start());
             V_6 = this.ExpandLoopBodyWithCrossEdges(V_5);
             V_7 = this.GetConstructsCollection(V_6);
             if (!this.CanBeLoop(V_3, V_4, V_6))
             {
                 continue;
             }
             dummyVar0 = V_0.Add(V_4);
             V_8       = V_7.GetEnumerator();
             try
             {
                 while (V_8.MoveNext())
                 {
                     V_9       = V_8.get_Current();
                     dummyVar1 = loopBody.Add(V_9);
                 }
             }
             finally
             {
                 if (V_8 != null)
                 {
                     V_8.Dispose();
                 }
             }
         }
     }
     finally
     {
         ((IDisposable)V_1).Dispose();
     }
     return(V_0);
 }
Ejemplo n.º 2
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()));
 }
Ejemplo n.º 3
0
        protected virtual ClassHierarchyNode FindLowestCommonAncestor(ICollection <ClassHierarchyNode> typeNodes)
        {
            V_0 = 0;
            V_1 = null;
            V_4 = typeNodes.GetEnumerator();
            try
            {
                while (V_4.MoveNext())
                {
                    V_0 = V_0 + 1;
                    V_1 = V_4.get_Current();
                }
            }
            finally
            {
                if (V_4 != null)
                {
                    V_4.Dispose();
                }
            }
            if (V_0 == 1)
            {
                return(V_1);
            }
            V_2 = new Queue <ClassHierarchyNode>();
            V_3 = new HashSet <ClassHierarchyNode>();
            V_4 = typeNodes.GetEnumerator();
            try
            {
                while (V_4.MoveNext())
                {
                    V_5 = V_4.get_Current();
                    if (V_2.get_Count() != 0)
                    {
                        V_10 = V_5;
                        while (!V_3.Contains(V_10))
                        {
                            stackVariable28 = V_5.get_CanAssignTo();
                            stackVariable29 = TypeInferer.u003cu003ec.u003cu003e9__18_0;
                            if (stackVariable29 == null)
                            {
                                dummyVar1       = stackVariable29;
                                stackVariable29 = new Func <ClassHierarchyNode, bool>(TypeInferer.u003cu003ec.u003cu003e9.u003cFindLowestCommonAncestoru003eb__18_0);
                                TypeInferer.u003cu003ec.u003cu003e9__18_0 = stackVariable29;
                            }
                            if (stackVariable28.Count <ClassHierarchyNode>(stackVariable29) <= 1)
                            {
                                stackVariable33 = V_10.get_CanAssignTo();
                                stackVariable34 = TypeInferer.u003cu003ec.u003cu003e9__18_1;
                                if (stackVariable34 == null)
                                {
                                    dummyVar2       = stackVariable34;
                                    stackVariable34 = new Func <ClassHierarchyNode, bool>(TypeInferer.u003cu003ec.u003cu003e9.u003cFindLowestCommonAncestoru003eb__18_1);
                                    TypeInferer.u003cu003ec.u003cu003e9__18_1 = stackVariable34;
                                }
                                V_10 = stackVariable33.FirstOrDefault <ClassHierarchyNode>(stackVariable34);
                            }
                            else
                            {
                                V_11 = null;
                                goto Label1;
                            }
                        }
                        while (V_2.Peek() != V_10)
                        {
                            dummyVar3 = V_3.Remove(V_2.Dequeue());
                        }
                    }
                    else
                    {
                        V_6 = V_5;
                        while (V_6 != null)
                        {
                            V_2.Enqueue(V_6);
                            dummyVar0 = V_3.Add(V_6);
                            V_7       = null;
                            V_8       = V_6.get_CanAssignTo().GetEnumerator();
                            try
                            {
                                while (V_8.MoveNext())
                                {
                                    V_9 = V_8.get_Current();
                                    if (!V_9.get_IsHardNode())
                                    {
                                        continue;
                                    }
                                    V_7 = V_9;
                                    goto Label2;
                                }
                            }
                            finally
                            {
                                if (V_8 != null)
                                {
                                    V_8.Dispose();
                                }
                            }
Label2:
                            V_6 = V_7;
                        }
                    }
                }
                goto Label0;
            }
            finally
            {
                if (V_4 != null)
                {
                    V_4.Dispose();
                }
            }
Label1:
            return(V_11);

Label0:
            return(V_2.Peek());
        }
Ejemplo n.º 4
0
		private List<TypeDefinition> GetInheritanceChain(TypeDefinition targetType, string definingTypeFullName)
		{
			V_0 = new List<TypeDefinition>();
			V_1 = new List<int>();
			V_0.Add(targetType);
			V_1.Add(-1);
			V_2 = -1;
			V_4 = 0;
			while (V_4 < V_0.get_Count())
			{
				V_5 = V_0.get_Item(V_4);
				if (V_5 == null || String.op_Equality(V_5.get_FullName(), definingTypeFullName))
				{
					V_2 = V_4;
					break;
				}
				else
				{
					V_6 = V_5.get_BaseType();
					if (V_6 != null)
					{
						V_7 = V_6.Resolve();
						if (V_7 != null)
						{
							V_0.Add(V_7);
							V_1.Add(V_4);
						}
					}
					V_8 = V_5.get_Interfaces().GetEnumerator();
					try
					{
						while (V_8.MoveNext())
						{
							V_9 = V_8.get_Current();
							if (V_9 == null)
							{
								continue;
							}
							V_10 = V_9.Resolve();
							if (V_10 == null)
							{
								continue;
							}
							V_0.Add(V_10);
							V_1.Add(V_4);
						}
					}
					finally
					{
						V_8.Dispose();
					}
					V_4 = V_4 + 1;
				}
			}
			V_3 = new List<TypeDefinition>();
			while (V_2 != -1)
			{
				V_3.Add(V_0.get_Item(V_2));
				V_2 = V_1.get_Item(V_2);
			}
			return V_3;
		}