private void MarkOptimizationAndCaseBlocks(InstructionBlock block, RemoveCompilerOptimizationsStep.SwitchData data)
 {
     V_0 = new Queue <InstructionBlock>();
     V_1 = new HashSet <int>();
     V_2 = block.get_Successors();
     V_3 = 0;
     while (V_3 < (int)V_2.Length)
     {
         V_0.Enqueue(V_2[V_3]);
         V_3 = V_3 + 1;
     }
     while (V_0.get_Count() > 0)
     {
         V_5       = V_0.Dequeue();
         dummyVar0 = V_1.Add(V_5.get_First().get_Offset());
         if (!this.IsOptimizationBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_OptimizationVariable()))
         {
             if (!this.IsCaseBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_SwitchExpression()) && !this.IsNullCaseBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_SwitchExpression()))
             {
                 continue;
             }
             this.switchBlocksToCasesMap.get_Item(block.get_First().get_Offset()).Add(V_5.get_First().get_Offset());
             V_8 = V_5.get_Successors()[1];
             if (this.IsEmptyStringCaseBlock(this.blockExpressions.get_Item(V_8.get_First().get_Offset()), data.get_SwitchExpression()))
             {
                 V_5.set_Last(V_8.get_Last());
                 V_5.set_Successors(V_8.get_Successors());
                 V_9 = this.blockExpressions.get_Item(V_5.get_First().get_Offset()).get_Item(0) as BinaryExpression;
                 V_9.set_Right(new LiteralExpression("", this.methodContext.get_Method().get_Module().get_TypeSystem(), null));
                 V_10 = this.blockExpressions.get_Item(V_8.get_First().get_Offset()).get_Item(0).get_UnderlyingSameMethodInstructions();
                 V_9  = V_9.CloneAndAttachInstructions(V_10) as BinaryExpression;
                 this.blockExpressions.get_Item(V_5.get_First().get_Offset()).set_Item(0, new UnaryExpression(11, V_9, null));
                 this.blocksToBeRemoved.Add(V_8.get_First().get_Offset());
             }
             dummyVar1 = this.MarkSecondSuccessorForRemovalIfItIsUnconditionalJump(V_5);
         }
         else
         {
             V_6 = V_5.get_Successors()[0];
             if (!V_1.Contains(V_6.get_First().get_Offset()))
             {
                 V_0.Enqueue(V_6);
             }
             V_7 = this.MarkSecondSuccessorForRemovalIfItIsUnconditionalJump(V_5);
             if (!V_1.Contains(V_7.get_First().get_Offset()) && this.IsOptimizationBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_OptimizationVariable()))
             {
                 V_0.Enqueue(V_7);
             }
             this.blocksToBeRemoved.Add(V_5.get_First().get_Offset());
         }
     }
     return;
 }
 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()));
 }
 private Dictionary <string, List <string> > GetModuleCollisionTypesData(ModuleDefinition module, ILanguage language)
 {
     V_0 = new Dictionary <string, List <string> >(language.get_IdentifierComparer());
     V_1 = new Dictionary <string, string>(language.get_IdentifierComparer());
     this.UpdateCollisionTypesDataWithTypes(V_0, V_1, module.get_Types());
     V_2 = this.GetModuleDependsOnAnalysis(module);
     if (Mono.Cecil.AssemblyResolver.Extensions.IsReferenceAssembly(module))
     {
         stackVariable16 = 1;
     }
     else
     {
         stackVariable16 = 0;
     }
     V_3 = stackVariable16;
     V_4 = V_2.get_Keys().GetEnumerator();
     try
     {
         while (V_4.MoveNext())
         {
             V_5 = V_4.get_Current();
             V_6 = module.get_AssemblyResolver().Resolve(V_5, "", ModuleDefinitionExtensions.GetModuleArchitecture(module), V_3, true);
             if (V_6 == null)
             {
                 this.UpdateCollisionTypesDataWithTypes(V_0, V_1, V_2.get_Item(V_5));
             }
             else
             {
                 V_7 = V_6.get_Modules().GetEnumerator();
                 try
                 {
                     while (V_7.MoveNext())
                     {
                         V_8 = V_7.get_Current();
                         this.UpdateCollisionTypesDataWithTypes(V_0, V_1, V_8.get_Types());
                     }
                 }
                 finally
                 {
                     V_7.Dispose();
                 }
             }
         }
     }
     finally
     {
         ((IDisposable)V_4).Dispose();
     }
     return(V_0);
 }
Ejemplo n.º 4
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.º 5
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.º 6
0
 private void CreateSwitchConstruct(CFGBlockLogicalConstruct switchBlock, ILogicalConstruct parentConstruct, SwitchData switchData, DominatorTree dominatorTree)
 {
     stackVariable2 = this.GetOrderedCFGSuccessorToLabelsMap(switchData);
     V_0            = this.GetValidCases(dominatorTree, switchBlock);
     V_1            = new List <CaseLogicalConstruct>();
     V_2            = new PairList <List <int>, CFGBlockLogicalConstruct>();
     V_8            = stackVariable2.GetEnumerator();
     try
     {
         while (V_8.MoveNext())
         {
             V_9 = V_8.get_Current();
             if (!LogicalFlowUtilities.TryGetParentConstructWithGivenParent(V_9.get_Key(), parentConstruct, out V_10) || !V_0.TryGetValue(V_10, out V_11))
             {
                 V_2.Add(V_9.get_Value(), V_9.get_Key());
             }
             else
             {
                 V_12 = new CaseLogicalConstruct(V_10);
                 V_12.get_CaseNumbers().AddRange(V_9.get_Value());
                 V_12.get_Body().UnionWith(V_11.Cast <ILogicalConstruct>());
                 V_12.AttachCaseConstructToGraph();
                 V_1.Add(V_12);
             }
         }
     }
     finally
     {
         ((IDisposable)V_8).Dispose();
     }
     V_3 = null;
     V_4 = this.GetCFGLogicalConstructFromBlock(switchData.get_DefaultCase());
     if (LogicalFlowUtilities.TryGetParentConstructWithGivenParent(V_4, parentConstruct, out V_5) && V_0.TryGetValue(V_5, out V_6))
     {
         V_3 = new CaseLogicalConstruct(V_5);
         if (this.HasSuccessors(V_6))
         {
             V_3.get_Body().UnionWith(V_6.Cast <ILogicalConstruct>());
         }
         V_3.AttachCaseConstructToGraph();
     }
     V_7 = SwitchLogicalConstruct.GroupInSwitchConstruct(switchBlock, V_1, V_2, V_3, V_4);
     this.UpdateDominatorTree(dominatorTree, V_7);
     return;
 }
Ejemplo n.º 7
0
 public override WriterContext GetWriterContext(IMemberDefinition member, ILanguage language)
 {
     if (member as TypeDefinition == null || member != Utilities.GetOuterMostDeclaringType(member))
     {
         V_1 = this.GetDecompiledType(member, language);
         V_0 = this.GetTypeContext(V_1, language);
     }
     else
     {
         V_7 = member as TypeDefinition;
         V_8 = this.GetNestedDecompiledTypes(V_7, language);
         V_0 = this.GetTypeContext(V_7, language, V_8);
         this.AddTypeContextsToCache(V_8, V_7, language);
         if (!V_8.TryGetValue(V_7.get_FullName(), out V_1))
         {
             throw new Exception("Decompiled type not found in decompiled types cache.");
         }
     }
     V_2 = new TypeSpecificContext(V_0.get_CurrentType(), V_0.get_MethodDefinitionToNameMap(), V_0.get_BackingFieldToNameMap(), V_0.get_UsedNamespaces(), new HashSet <string>(), V_0.get_AssignmentData(), V_0.get_AutoImplementedProperties(), V_0.get_AutoImplementedEvents(), V_0.get_ExplicitlyImplementedMembers(), V_0.get_ExceptionWhileDecompiling(), V_0.get_GeneratedFilterMethods(), V_0.get_GeneratedMethodDefinitionToNameMap());
     if (V_2.get_GeneratedFilterMethods().get_Count() > 0)
     {
         this.AddGeneratedFilterMethodsToDecompiledType(V_1, V_2, language);
     }
     V_3 = new Dictionary <string, MethodSpecificContext>();
     V_4 = new Dictionary <string, Statement>();
     V_9 = V_1.get_DecompiledMembers().GetEnumerator();
     try
     {
         while (V_9.MoveNext())
         {
             V_10 = V_9.get_Current();
             V_3.Add(V_10.get_Key(), V_10.get_Value().get_Context());
             V_4.Add(V_10.get_Key(), V_10.get_Value().get_Statement());
         }
     }
     finally
     {
         ((IDisposable)V_9).Dispose();
     }
     V_5             = Utilities.GetDeclaringTypeOrSelf(member);
     stackVariable66 = this.GetAssemblyContext(V_5.get_Module().get_Assembly(), language);
     V_6             = this.GetModuleContext(V_5.get_Module(), language);
     return(new WriterContext(stackVariable66, V_6, V_2, V_3, V_4));
 }
 private WriterContext GetWriterContextForType(TypeDefinition type, ILanguage language)
 {
     V_0 = Utilities.GetOuterMostDeclaringType(type);
     if (!this.cacheService.AreNestedDecompiledTypesInCache(V_0, language, this.renameInvalidMembers))
     {
         V_1 = this.GetNestedDecompiledTypes(V_0, language);
         this.cacheService.AddNestedDecompiledTypesToCache(V_0, language, this.renameInvalidMembers, V_1);
     }
     else
     {
         V_1 = this.cacheService.GetNestedDecompiledTypesFromCache(V_0, language, this.renameInvalidMembers);
     }
     V_2 = this.GetTypeContext(V_0, language, V_1);
     this.AddTypeContextsToCache(V_1, V_0, language);
     V_3 = new Dictionary <string, MethodSpecificContext>();
     V_4 = new Dictionary <string, Statement>();
     if (!V_1.TryGetValue(type.get_FullName(), out V_5))
     {
         throw new Exception("Decompiled type missing from DecompiledTypes cache.");
     }
     if (V_2.get_GeneratedFilterMethods().get_Count() > 0)
     {
         this.AddGeneratedFilterMethodsToDecompiledType(V_5, V_2, language);
     }
     V_7 = V_5.get_DecompiledMembers().get_Values().GetEnumerator();
     try
     {
         while (V_7.MoveNext())
         {
             V_8 = V_7.get_Current();
             V_3.Add(V_8.get_MemberFullName(), V_8.get_Context());
             V_4.Add(V_8.get_MemberFullName(), V_8.get_Statement());
         }
     }
     finally
     {
         ((IDisposable)V_7).Dispose();
     }
     stackVariable63 = this.GetAssemblyContext(V_0.get_Module().get_Assembly(), language);
     V_6             = this.GetModuleContext(V_0.get_Module(), language);
     return(new WriterContext(stackVariable63, V_6, V_2, V_3, V_4));
 }
Ejemplo n.º 9
0
 private void ProcessGotoFlowConstructs(BlockLogicalConstruct theConstruct)
 {
     V_0 = new ILogicalConstruct[theConstruct.get_Children().get_Count()];
     V_1 = 0;
     V_3 = theConstruct.get_Children().GetEnumerator();
     try
     {
         while (V_3.MoveNext())
         {
             V_4                  = (ILogicalConstruct)V_3.get_Current();
             stackVariable14      = V_1;
             V_1                  = stackVariable14 + 1;
             V_0[stackVariable14] = V_4;
         }
     }
     finally
     {
         ((IDisposable)V_3).Dispose();
     }
     Array.Sort <ISingleEntrySubGraph>(V_0);
     V_2 = new HashSet <ILogicalConstruct>();
     V_6 = V_0;
     V_7 = 0;
     while (V_7 < (int)V_6.Length)
     {
         V_8 = V_6[V_7];
         if (this.visitedConstructs.Add(V_8))
         {
             if (this.visitedConstructs.Contains(V_8.get_FollowNode()) || !V_2.Add(V_8.get_FollowNode()))
             {
                 V_8.set_CFGFollowNode(null);
             }
             this.ProcessLogicalConstruct(V_8);
         }
         V_7 = V_7 + 1;
     }
     return;
 }
Ejemplo n.º 10
0
		public void VisitMethodInvocationExpression(MethodInvocationExpression node)
		{
			if (!node.get_VirtualCall())
			{
				V_0 = node.get_MethodExpression();
				if (V_0 == null)
				{
					return;
				}
				if (V_0.get_Target() as ThisReferenceExpression != null)
				{
					V_7 = this.method.get_DeclaringType().Resolve();
					if (V_7 != null && (object)V_7 != (object)V_0.get_Method().get_DeclaringType().Resolve())
					{
						V_8 = this.method.get_DeclaringType().get_BaseType();
						if (V_8 == null || String.op_Equality(V_8.get_FullName(), Type.GetTypeFromHandle(// 
						// Current member / type: System.Void Telerik.JustDecompiler.Steps.HandleVirtualMethodInvocations::VisitMethodInvocationExpression(Telerik.JustDecompiler.Ast.Expressions.MethodInvocationExpression)
						// Exception in: System.Void VisitMethodInvocationExpression(Telerik.JustDecompiler.Ast.Expressions.MethodInvocationExpression)
						// Specified method is not supported.
						// 
						// mailto: [email protected]

	}
}
Ejemplo n.º 11
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;
		}
Ejemplo n.º 12
0
        private LoopType DetermineLoopType(HashSet <ILogicalConstruct> loopBody, HashSet <ILogicalConstruct> latchingNodes, IntervalConstruct interval, DominatorTree dominatorTree, out ConditionLogicalConstruct loopCondition)
        {
            V_0       = interval.get_Entry() as ILogicalConstruct;
            V_1       = new HashSet <ILogicalConstruct>(latchingNodes);
            dummyVar0 = V_1.Add(V_0);
            V_2       = DFSTBuilder.BuildTree(V_0.get_Parent() as ILogicalConstruct);
            V_3       = new HashSet <ILogicalConstruct>();
            V_4       = loopBody.GetEnumerator();
            try
            {
                while (V_4.MoveNext())
                {
                    V_5 = V_4.get_Current();
                    V_6 = dominatorTree.GetDominanceFrontier(V_5).GetEnumerator();
                    try
                    {
                        while (V_6.MoveNext())
                        {
                            V_7 = (ILogicalConstruct)V_6.get_Current();
                            if (!interval.get_Children().Contains(V_7) || loopBody.Contains(V_7))
                            {
                                continue;
                            }
                            dummyVar1 = V_3.Add(V_7);
                        }
                    }
                    finally
                    {
                        ((IDisposable)V_6).Dispose();
                    }
                }
            }
            finally
            {
                ((IDisposable)V_4).Dispose();
            }
            if (V_3.get_Count() == 0)
            {
                V_8 = V_2.get_ReversePostOrder().GetEnumerator();
                try
                {
                    while (V_8.MoveNext())
                    {
                        V_9 = V_8.get_Current().get_Construct() as ILogicalConstruct;
                        if (loopBody.Contains(V_9))
                        {
                            continue;
                        }
                        loopCondition = this.GetLoopConditionWithMaxIndex(V_2, loopBody, V_1, V_9);
                        if (loopCondition == null)
                        {
                            continue;
                        }
                        this.ExpandLoopBody(interval, loopBody, V_9);
                        if (loopCondition != V_0)
                        {
                            V_10 = 2;
                            goto Label1;
                        }
                        else
                        {
                            V_10 = 1;
                            goto Label1;
                        }
                    }
                    goto Label0;
                }
                finally
                {
                    ((IDisposable)V_8).Dispose();
                }
Label1:
                return(V_10);
            }
            V_11 = V_2.get_ReversePostOrder().get_Count();
            V_4  = V_3.GetEnumerator();
            try
            {
                while (V_4.MoveNext())
                {
                    V_13 = V_4.get_Current();
                    V_14 = V_2.get_ConstructToNodeMap().get_Item(V_13).get_ReversePostOrderIndex();
                    if (V_14 >= V_11)
                    {
                        continue;
                    }
                    V_11 = V_14;
                }
            }
            finally
            {
                ((IDisposable)V_4).Dispose();
            }
            V_12          = V_2.get_ReversePostOrder().get_Item(V_11).get_Construct() as ILogicalConstruct;
            loopCondition = this.GetLoopConditionWithMaxIndex(V_2, loopBody, V_1, V_12);
            this.ExpandLoopBody(interval, loopBody, V_12);
            if (loopCondition == null)
            {
                return(0);
            }
            if (loopCondition == V_0)
            {
                return(1);
            }
            return(2);

Label0:
            if (!this.CanBeLoopCondition(V_0, loopBody))
            {
                loopCondition = null;
                return(0);
            }
            loopCondition = V_0 as ConditionLogicalConstruct;
            return(1);
        }
 public override void VisitBinaryExpression(BinaryExpression node)
 {
     V_0 = this.GetExpressionTypeName(node.get_Left());
     V_1 = this.GetExpressionTypeName(node.get_Right());
     this.VisitBinaryExpression(node);
     if (String.op_Inequality(this.GetExpressionTypeName(node.get_Left()), V_0))
     {
         stackVariable16 = true;
     }
     else
     {
         stackVariable16 = String.op_Inequality(this.GetExpressionTypeName(node.get_Right()), V_1);
     }
     V_2 = stackVariable16;
     if (node.get_IsAssignmentExpression() || node.get_IsSelfAssign() && !node.get_IsEventHandlerAddOrRemove())
     {
         V_3 = node.get_Left();
         V_4 = node.get_Right();
         if (V_4.get_HasType() && V_3.get_HasType())
         {
             V_5 = V_3.get_ExpressionType();
             V_6 = V_4.get_ExpressionType().Resolve();
             if (this.ShouldAddCast(V_6, V_5))
             {
                 node.set_Right(new ExplicitCastExpression(V_4, V_5, null));
                 V_2 = true;
             }
             V_7 = V_5.Resolve();
             if (V_7 != null && V_6 != null && V_7.get_IsEnum() && V_6.get_IsValueType() && String.op_Inequality(V_7.get_FullName(), V_6.get_FullName()))
             {
                 node.set_Right(new ExplicitCastExpression(V_4, V_5, null));
                 V_2 = true;
             }
         }
     }
     else
     {
         if (!this.IsArithmeticOperator(node.get_Operator()))
         {
             if (this.IsBitwiseOperator(node.get_Operator()) || node.get_IsComparisonExpression())
             {
                 V_10 = node.get_Left();
                 V_11 = node.get_Right();
                 if (V_11.get_HasType() && V_10.get_HasType())
                 {
                     V_12 = V_10.get_ExpressionType();
                     V_13 = V_11.get_ExpressionType().Resolve();
                     if (this.ShouldAddCast(V_13, V_12))
                     {
                         node.set_Right(new ExplicitCastExpression(V_11, V_12, null));
                         V_2 = true;
                     }
                     V_14 = V_11.get_ExpressionType();
                     V_15 = V_10.get_ExpressionType().Resolve();
                     if (this.ShouldAddCast(V_15, V_14))
                     {
                         node.set_Left(new ExplicitCastExpression(V_10, V_14, null));
                         V_2 = true;
                     }
                     if (V_15 != null && V_15.get_IsEnum() && V_13 != null && V_13.get_IsEnum() && String.op_Inequality(V_15.get_FullName(), V_13.get_FullName()))
                     {
                         node.set_Left(new ExplicitCastExpression(V_10, this.GetEnumUnderlyingType(V_15), null));
                         node.set_Right(new ExplicitCastExpression(V_11, this.GetEnumUnderlyingType(V_15), null));
                         V_2 = true;
                     }
                 }
             }
             else
             {
                 if (this.IsShiftOperator(node.get_Operator()))
                 {
                     if (node.get_Left().get_HasType())
                     {
                         V_16 = node.get_Left().get_ExpressionType().Resolve();
                         if (V_16 != null && V_16.get_IsEnum())
                         {
                             node.set_Left(new ExplicitCastExpression(node.get_Left(), this.GetEnumUnderlyingType(V_16), null));
                             V_2 = true;
                         }
                     }
                     if (node.get_Right().get_HasType())
                     {
                         V_17 = node.get_Right().get_ExpressionType().Resolve();
                         if (V_17 != null && V_17.get_IsEnum())
                         {
                             node.set_Right(new ExplicitCastExpression(node.get_Right(), this.GetEnumUnderlyingType(V_17), null));
                             V_2 = true;
                         }
                     }
                 }
             }
         }
         else
         {
             if (node.get_Left().get_HasType())
             {
                 V_8 = node.get_Left().get_ExpressionType().Resolve();
                 if (V_8 != null && V_8.get_IsEnum())
                 {
                     node.set_Left(new ExplicitCastExpression(node.get_Left(), this.GetEnumUnderlyingType(V_8), null));
                     V_2 = true;
                 }
             }
             if (node.get_Right().get_HasType())
             {
                 V_9 = node.get_Right().get_ExpressionType().Resolve();
                 if (V_9 != null && V_9.get_IsEnum())
                 {
                     node.set_Right(new ExplicitCastExpression(node.get_Right(), this.GetEnumUnderlyingType(V_9), null));
                     V_2 = true;
                 }
             }
         }
     }
     if (V_2)
     {
         node.UpdateType();
     }
     return;
 }
Ejemplo n.º 14
0
 private void Preprocess()
 {
     V_0 = 0;
     V_1 = new Dictionary <ParameterDefinition, string>();
     V_2 = this.methodContext.get_ParameterDefinitionToNameMap().GetEnumerator();
     try
     {
         while (V_2.MoveNext())
         {
             V_3 = V_2.get_Current();
             V_4 = V_3.get_Key();
             V_5 = V_3.get_Value();
             V_6 = V_5;
             V_7 = !V_6.IsValidIdentifier();
             while (V_7 || this.HasMethodParameterWithSameName(V_6))
             {
                 V_7             = false;
                 stackVariable22 = V_0;
                 V_0             = stackVariable22 + 1;
                 V_8             = stackVariable22;
                 V_6             = String.Concat("argument", V_8.ToString());
             }
             if (!String.op_Inequality(V_6, V_5))
             {
                 continue;
             }
             V_1.Add(V_4, V_6);
         }
     }
     finally
     {
         ((IDisposable)V_2).Dispose();
     }
     V_2 = V_1.GetEnumerator();
     try
     {
         while (V_2.MoveNext())
         {
             V_9 = V_2.get_Current();
             this.methodContext.get_ParameterDefinitionToNameMap().set_Item(V_9.get_Key(), V_9.get_Value());
         }
     }
     finally
     {
         ((IDisposable)V_2).Dispose();
     }
     V_10 = this.methodContext.get_Body().get_Method().get_Parameters().GetEnumerator();
     try
     {
         while (V_10.MoveNext())
         {
             V_11 = V_10.get_Current();
             V_12 = V_11.get_Name();
             if (String.IsNullOrEmpty(V_12))
             {
                 V_12 = this.GetNameByType(V_11.get_ParameterType());
             }
             this.methodContext.get_ParameterDefinitionToNameMap().Add(V_11, V_12);
         }
     }
     finally
     {
         V_10.Dispose();
     }
     if (this.methodContext.get_Method().get_IsSetter() && this.methodContext.get_Method().get_Parameters().get_Count() == 1)
     {
         V_13 = this.methodContext.get_Method().get_Parameters().get_Item(0);
         this.methodContext.get_ParameterDefinitionToNameMap().set_Item(V_13, "value");
     }
     V_14 = this.methodContext.get_Body().get_Variables().GetEnumerator();
     try
     {
         while (V_14.MoveNext())
         {
             V_15 = V_14.get_Current();
             if (!this.methodContext.get_ParameterDefinitionToNameMap().ContainsValue(V_15.get_Name()))
             {
                 continue;
             }
             dummyVar0 = this.methodContext.get_VariablesToRename().Add(V_15);
         }
     }
     finally
     {
         V_14.Dispose();
     }
     V_16 = this.methodContext.get_VariableDefinitionToNameMap().GetEnumerator();
     try
     {
         while (V_16.MoveNext())
         {
             V_17 = V_16.get_Current();
             if (!this.methodContext.get_ParameterDefinitionToNameMap().ContainsValue(V_17.get_Value()))
             {
                 continue;
             }
             dummyVar1 = this.methodContext.get_VariablesToRename().Add(V_17.get_Key());
         }
     }
     finally
     {
         ((IDisposable)V_16).Dispose();
     }
     return;
 }
 private void ProcessCurrentNode(YieldExceptionHandlerInfo handlerInfo, Queue <ILogicalConstruct> bfsQueue, ILogicalConstruct currentNode)
 {
     if (currentNode as CFGBlockLogicalConstruct == null)
     {
         if (currentNode as TryFinallyLogicalConstruct != null && this.createdConstructsToIntervalMap.TryGetValue(currentNode as TryFinallyLogicalConstruct, out V_10) && V_10.get_TryStates().IsProperSupersetOf(handlerInfo.get_TryStates()))
         {
             throw new Exception("This try/finally construct cannot be nested in the current construct");
         }
     }
     else
     {
         V_0 = currentNode as CFGBlockLogicalConstruct;
         V_1 = 0;
         while (V_1 < V_0.get_LogicalConstructExpressions().get_Count())
         {
             V_2 = V_0.get_LogicalConstructExpressions().get_Item(V_1);
             if (!this.TryGetStateAssignValue(V_2, out V_3))
             {
                 if (handlerInfo.get_HandlerType() == YieldExceptionHandlerType.Method && V_2.get_CodeNodeType() == 19 && (object)(V_2 as MethodInvocationExpression).get_MethodExpression().get_MethodDefinition() == (object)handlerInfo.get_FinallyMethodDefinition())
                 {
                     if (V_0.get_LogicalConstructExpressions().get_Count() == 1)
                     {
                         if (this.newFinallyBody == null)
                         {
                             this.newFinallyBody = V_0;
                         }
                         dummyVar0 = this.finallyBlocks.Add(this.newFinallyBody);
                         dummyVar1 = this.orderedCFGNodes.Remove(V_0);
                         return;
                     }
                     if (V_1 != 0)
                     {
                         if (V_1 >= V_0.get_LogicalConstructExpressions().get_Count() - 1)
                         {
                             V_8       = LogicalFlowUtilities.SplitCFGBlockAt(this.logicalContext, V_0, V_1);
                             dummyVar3 = this.newTryBody.Add(V_8.get_Key());
                             V_4       = V_8.get_Value();
                             dummyVar4 = this.orderedCFGNodes.Remove(V_0);
                         }
                         else
                         {
                             V_6       = LogicalFlowUtilities.SplitCFGBlockAt(this.logicalContext, V_0, V_1);
                             dummyVar2 = this.newTryBody.Add(V_6.get_Key());
                             V_7       = LogicalFlowUtilities.SplitCFGBlockAt(this.logicalContext, V_6.get_Value(), 1);
                             V_4       = V_7.get_Key();
                             this.orderedCFGNodes.set_Item(this.orderedCFGNodes.IndexOf(V_0), V_7.get_Value());
                         }
                     }
                     else
                     {
                         V_5 = LogicalFlowUtilities.SplitCFGBlockAt(this.logicalContext, V_0, V_1 + 1);
                         V_4 = V_5.get_Key();
                         this.orderedCFGNodes.set_Item(this.orderedCFGNodes.IndexOf(V_0), V_5.get_Value());
                     }
                     if (this.newFinallyBody == null)
                     {
                         this.newFinallyBody = V_4;
                     }
                     dummyVar5 = this.finallyBlocks.Add(V_4);
                     return;
                 }
             }
             else
             {
                 if (!handlerInfo.get_TryStates().Contains(V_3))
                 {
                     if (handlerInfo.get_HandlerType() == YieldExceptionHandlerType.Method || !this.TryProcessConditionalDisposeHandler(handlerInfo, V_0))
                     {
                         throw new Exception("Invalid state value");
                     }
                     return;
                 }
             }
             V_1 = V_1 + 1;
         }
     }
     dummyVar6 = this.newTryBody.Add(currentNode);
     V_11      = currentNode.get_SameParentSuccessors().GetEnumerator();
     try
     {
         while (V_11.MoveNext())
         {
             V_12 = (ILogicalConstruct)V_11.get_Current();
             bfsQueue.Enqueue(V_12);
         }
     }
     finally
     {
         ((IDisposable)V_11).Dispose();
     }
     return;
 }
Ejemplo n.º 16
0
 internal void RemoveBlockAt(int index)
 {
     V_0 = this.get_Blocks()[index];
     V_1 = V_0.get_Last().get_Next();
     if (V_0.get_Predecessors().get_Count() > 0)
     {
         throw new Exception("The block to be removed cannot have predecessors");
     }
     V_2 = this.get_Blocks();
     this.set_Blocks(new InstructionBlock[(int)this.get_Blocks().Length - 1]);
     V_3 = 0;
     while (V_3 < (int)this.get_Blocks().Length)
     {
         if (V_3 >= index)
         {
             stackVariable29 = 1;
         }
         else
         {
             stackVariable29 = 0;
         }
         V_4 = stackVariable29;
         this.get_Blocks()[V_3] = V_2[V_3 + V_4];
         this.get_Blocks()[V_3].set_Index(V_3);
         dummyVar0 = this.get_Blocks()[V_3].get_Predecessors().Remove(V_0);
         if ((object)this.get_Blocks()[V_3].get_First().get_Previous() == (object)V_0.get_Last())
         {
             this.get_Blocks()[V_3].get_First().set_Previous(V_0.get_First().get_Previous());
         }
         if ((object)this.get_Blocks()[V_3].get_Last().get_Next() == (object)V_0.get_First())
         {
             this.get_Blocks()[V_3].get_Last().set_Next(V_0.get_Last().get_Next());
         }
         V_3 = V_3 + 1;
     }
     dummyVar1 = this.get_InstructionToBlockMapping().Remove(V_0.get_First().get_Offset());
     dummyVar2 = this.get_SwitchBlocksInformation().Remove(V_0);
     V_0.set_Successors(new InstructionBlock[0]);
     V_5 = V_0.GetEnumerator();
     try
     {
         while (V_5.MoveNext())
         {
             V_6       = V_5.get_Current();
             dummyVar3 = this.get_OffsetToInstruction().Remove(V_6.get_Offset());
         }
     }
     finally
     {
         if (V_5 != null)
         {
             V_5.Dispose();
         }
     }
     V_7 = this.get_MethodBody().get_ExceptionHandlers().GetEnumerator();
     try
     {
         while (V_7.MoveNext())
         {
             V_8 = V_7.get_Current();
             if ((object)V_8.get_TryStart() == (object)V_0.get_First())
             {
                 V_8.set_TryStart(V_1);
             }
             if ((object)V_8.get_TryEnd() == (object)V_0.get_First())
             {
                 V_8.set_TryEnd(V_1);
             }
             if ((object)V_8.get_HandlerStart() == (object)V_0.get_First())
             {
                 V_8.set_HandlerStart(V_1);
             }
             if ((object)V_8.get_HandlerEnd() == (object)V_0.get_First())
             {
                 V_8.set_HandlerEnd(V_1);
             }
             if ((object)V_8.get_FilterStart() == (object)V_0.get_First())
             {
                 V_8.set_FilterStart(V_1);
             }
             if ((object)V_8.get_FilterEnd() != (object)V_0.get_First())
             {
                 continue;
             }
             V_8.set_FilterEnd(V_1);
         }
     }
     finally
     {
         V_7.Dispose();
     }
     V_0.set_Index(-1);
     return;
 }
Ejemplo n.º 17
0
 private void AddCasts()
 {
     V_0 = this.context.get_MethodContext().get_StackData().get_VariableToDefineUseInfo().GetEnumerator();
     try
     {
         while (V_0.MoveNext())
         {
             V_1 = V_0.get_Current();
             V_2 = V_1.get_Value().get_UsedAt().GetEnumerator();
             try
             {
                 while (V_2.MoveNext())
                 {
                     V_3 = V_2.get_Current();
                     if (!this.offsetToExpression.TryGetValue(V_3, out V_4))
                     {
                         continue;
                     }
                     this.AddCastIfNeeded(V_4, V_1.get_Key());
                 }
             }
             finally
             {
                 ((IDisposable)V_2).Dispose();
             }
             V_5 = V_1.get_Value().get_DefinedAt().GetEnumerator();
             try
             {
                 while (V_5.MoveNext())
                 {
                     V_6 = V_5.get_Current();
                     V_7 = this.offsetToExpression.get_Item(V_6);
                     V_8 = this.GetInstructionBlock(V_6);
                     V_9 = this.context.get_MethodContext().get_Expressions().get_BlockExpressions().get_Item(V_8.get_First().get_Offset());
                     this.FixAssignmentInList(V_9, V_7);
                 }
             }
             finally
             {
                 ((IDisposable)V_5).Dispose();
             }
         }
     }
     finally
     {
         ((IDisposable)V_0).Dispose();
     }
     return;
 }
Ejemplo n.º 18
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.º 19
0
 public virtual void WriteAssemblyAttributes(AssemblyDefinition assembly, ICollection <string> attributesToIgnore = null)
 {
     V_0 = new List <ICustomAttribute>();
     this.securityAttributeToDeclaration = new Dictionary <SecurityAttribute, SecurityDeclaration>();
     V_0.Add(AttributesUtilities.GetAssemblyVersionAttribute(assembly));
     V_2 = assembly.get_CustomAttributes().GetEnumerator();
     try
     {
         while (V_2.MoveNext())
         {
             V_3 = V_2.get_Current();
             V_3.Resolve();
             V_0.Add(V_3);
         }
     }
     finally
     {
         V_2.Dispose();
     }
     if (assembly.get_HasSecurityDeclarations())
     {
         V_4 = assembly.get_SecurityDeclarations().GetEnumerator();
         try
         {
             while (V_4.MoveNext())
             {
                 V_5 = V_4.get_Current();
                 V_0.AddRange(this.GetSecurityDeclaration(V_5));
             }
         }
         finally
         {
             V_4.Dispose();
         }
     }
     if (assembly.get_MainModule().get_HasExportedTypes())
     {
         V_6 = assembly.get_MainModule().get_ExportedTypes().GetEnumerator();
         try
         {
             while (V_6.MoveNext())
             {
                 V_7 = V_6.get_Current();
                 if (V_7.get_Scope() as ModuleReference != null)
                 {
                     continue;
                 }
                 V_0.Add(AttributesUtilities.GetExportedTypeAttribute(V_7, assembly.get_MainModule()));
             }
         }
         finally
         {
             V_6.Dispose();
         }
     }
     V_0.Sort(new Comparison <ICustomAttribute>(this.u003cWriteAssemblyAttributesu003eb__18_0));
     V_8 = V_0.GetEnumerator();
     try
     {
         while (V_8.MoveNext())
         {
             V_9 = V_8.get_Current();
             if (attributesToIgnore != null && attributesToIgnore.Contains(V_9.get_AttributeType().get_FullName()))
             {
                 continue;
             }
             if (V_9 as CustomAttribute == null)
             {
                 if (V_9 as SecurityAttribute == null)
                 {
                     continue;
                 }
                 dummyVar0 = this.WriteSecurityAttribute(assembly.get_MainModule(), true, V_9 as SecurityAttribute, this.securityAttributeToDeclaration.get_Item(V_9 as SecurityAttribute), out V_10, false, false);
             }
             else
             {
                 this.WriteAssemblyAttribute(V_9 as CustomAttribute);
             }
         }
     }
     finally
     {
         ((IDisposable)V_8).Dispose();
     }
     return;
 }
Ejemplo n.º 20
0
 protected void DecompileConstructorChain(MethodDefinition method, ILanguage language, DecompiledType decompiledType)
 {
     if (this.cacheService.IsDecompiledMemberInCache(method, language, this.renameInvalidMembers))
     {
         V_3 = this.cacheService.GetDecompiledMemberFromCache(method, language, this.renameInvalidMembers);
         this.AddDecompiledMemberToDecompiledType(V_3, decompiledType);
         BaseWriterContextService.AddAssignmentDataToDecompiledType(V_3, decompiledType);
         return;
     }
     if (method.get_Body() == null)
     {
         V_4 = new CachedDecompiledMember(new DecompiledMember(Utilities.GetMemberUniqueName(method), null, null));
         this.cacheService.AddDecompiledMemberToCache(method, language, this.renameInvalidMembers, V_4);
         return;
     }
     V_0 = this.DecompileMethod(language, method, decompiledType.get_TypeContext().ShallowPartialClone());
     V_1 = new List <CachedDecompiledMember>();
     V_2 = method.get_DeclaringType();
     if (!method.get_IsStatic())
     {
         V_5 = V_2.get_Methods().GetEnumerator();
         try
         {
             while (V_5.MoveNext())
             {
                 V_6 = V_5.get_Current();
                 if (!V_6.get_IsConstructor() || String.op_Equality(V_6.get_FullName(), V_0.get_Member().get_MemberFullName()) || V_6.get_IsStatic())
                 {
                     continue;
                 }
                 if (V_6.get_Body() != null)
                 {
                     V_1.Add(this.DecompileMethod(language, V_6, decompiledType.get_TypeContext().ShallowPartialClone()));
                 }
                 else
                 {
                     V_7 = new CachedDecompiledMember(new DecompiledMember(Utilities.GetMemberUniqueName(V_6), null, null));
                     V_1.Add(V_7);
                 }
             }
         }
         finally
         {
             V_5.Dispose();
         }
         V_1.Add(V_0);
         this.MergeConstructorsTypeContexts(V_1, decompiledType);
         V_8 = V_1.GetEnumerator();
         try
         {
             while (V_8.MoveNext())
             {
                 V_9             = new BaseWriterContextService.u003cu003ec__DisplayClass15_0();
                 V_9.constructor = V_8.get_Current();
                 if (language as IntermediateLanguage == null)
                 {
                     this.RemoveBaseCtorInvocationStatements(V_9.constructor, decompiledType);
                 }
                 if (V_9.constructor.get_Member().get_Context() != null)
                 {
                     if (!this.cacheService.IsDecompiledMemberInCache(V_9.constructor.get_Member().get_Context().get_Method(), language, this.renameInvalidMembers))
                     {
                         this.cacheService.AddDecompiledMemberToCache(V_9.constructor.get_Member().get_Context().get_Method(), language, this.renameInvalidMembers, V_9.constructor);
                     }
                 }
                 else
                 {
                     V_10 = decompiledType.get_Type().get_Methods().First <MethodDefinition>(new Func <MethodDefinition, bool>(V_9.u003cDecompileConstructorChainu003eb__0));
                     if (!this.cacheService.IsDecompiledMemberInCache(V_10, language, this.renameInvalidMembers))
                     {
                         this.cacheService.AddDecompiledMemberToCache(V_10, language, this.renameInvalidMembers, V_9.constructor);
                     }
                 }
                 this.AddDecompiledMemberToDecompiledType(V_9.constructor, decompiledType);
             }
         }
         finally
         {
             ((IDisposable)V_8).Dispose();
         }
     }
     return;
 }
 public static bool TryMatch(BlockStatement filter, out VariableDeclarationExpression variableDeclaration, out Expression filterExpression)
 {
     variableDeclaration = null;
     filterExpression    = null;
     if (!CatchClausesFilterPattern.TryMatchVariableDeclaration(filter, out variableDeclaration))
     {
         return(false);
     }
     if (filter.get_Statements().get_Count() != 3)
     {
         return(false);
     }
     V_0 = filter.get_Statements().get_Item(1) as IfStatement;
     if (V_0 == null)
     {
         return(false);
     }
     V_1 = null;
     V_2 = null;
     if ((V_0.get_Condition() as BinaryExpression).get_Operator() != 10)
     {
         V_1 = V_0.get_Else();
         V_2 = V_0.get_Then();
     }
     else
     {
         V_1 = V_0.get_Then();
         V_2 = V_0.get_Else();
     }
     V_3 = null;
     V_4 = null;
     if (V_1.get_Statements().get_Count() != 1 && V_1.get_Statements().get_Count() != 2 && V_1.get_Statements().get_Count() != 3 || V_2.get_Statements().get_Count() != 1)
     {
         return(false);
     }
     if (V_1.get_Statements().get_Count() != 2)
     {
         if (V_1.get_Statements().get_Count() == 3)
         {
             V_8 = V_1.get_Statements().get_Item(0) as ExpressionStatement;
             V_9 = V_1.get_Statements().get_Item(1) as ExpressionStatement;
             if (V_8 == null || V_9 == null)
             {
                 return(false);
             }
             if (V_8.get_Expression().get_CodeNodeType() != 24 || V_9.get_Expression().get_CodeNodeType() != 19)
             {
                 if (V_8.get_Expression().get_CodeNodeType() != 19 || V_9.get_Expression().get_CodeNodeType() != 24)
                 {
                     return(false);
                 }
                 V_4 = V_8;
                 V_3 = V_9;
             }
             else
             {
                 V_3 = V_8;
                 V_4 = V_9;
             }
         }
     }
     else
     {
         V_7 = V_1.get_Statements().get_Item(0) as ExpressionStatement;
         if (V_7 == null)
         {
             return(false);
         }
         if (V_7.get_Expression().get_CodeNodeType() != 24)
         {
             if (V_7.get_Expression().get_CodeNodeType() != 19)
             {
                 return(false);
             }
             V_4 = V_7;
         }
         else
         {
             V_3 = V_7;
         }
     }
     if (V_3 != null)
     {
         V_10 = V_3.get_Expression() as BinaryExpression;
         if (V_10 == null || !V_10.get_IsAssignmentExpression() || String.op_Inequality(V_10.get_ExpressionType().get_FullName(), variableDeclaration.get_ExpressionType().get_FullName()))
         {
             return(false);
         }
         stackVariable98 = V_10.get_Left() as VariableReferenceExpression;
         V_11            = V_10.get_Right() as VariableReferenceExpression;
         if (stackVariable98 == null || V_11 == null)
         {
             return(false);
         }
     }
     if (V_4 != null)
     {
         V_12 = V_4.get_Expression() as MethodInvocationExpression;
         if (V_12 == null || String.op_Inequality(V_12.get_MethodExpression().get_Method().get_FullName(), "System.Void Microsoft.VisualBasic.CompilerServices.ProjectData::SetProjectError(System.Exception)"))
         {
             return(false);
         }
     }
     V_5 = filter.get_Statements().get_Item(2) as ExpressionStatement;
     if (V_5 == null)
     {
         return(false);
     }
     V_6 = V_5.get_Expression() as VariableReferenceExpression;
     if (V_6 == null)
     {
         return(false);
     }
     if (!CatchClausesFilterPattern.TryMatchFilterExpression(V_0, variableDeclaration.get_Variable().get_VariableType(), V_6, out filterExpression))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 22
0
 public static int CompareToSecurityAttribute(this SecurityAttribute first, SecurityAttribute second, SecurityDeclaration firstDeclaration, SecurityDeclaration secondDeclaration)
 {
     if ((object)first == (object)second)
     {
         return(0);
     }
     V_0 = firstDeclaration.get_Action().ToString();
     V_1 = secondDeclaration.get_Action().ToString();
     if (String.op_Inequality(V_0, V_1))
     {
         return(V_0.CompareTo(V_1));
     }
     V_2 = Math.Max(first.get_Properties().get_Count(), second.get_Properties().get_Count());
     V_5 = 0;
     while (V_5 < V_2)
     {
         if (V_5 >= first.get_Properties().get_Count())
         {
             return(1);
         }
         if (V_5 >= second.get_Properties().get_Count())
         {
             return(-1);
         }
         V_6 = first.get_Properties().get_Item(V_5);
         V_7 = second.get_Properties().get_Item(V_5);
         if (!String.op_Equality(V_6.get_Name(), V_7.get_Name()))
         {
             return(V_6.get_Name().CompareTo(V_7.get_Name()));
         }
         V_10 = V_6.get_Argument();
         V_8  = V_10.get_Value().ToString();
         V_10 = V_7.get_Argument();
         V_9  = V_10.get_Value().ToString();
         if (String.op_Inequality(V_8, V_9))
         {
             return(V_8.CompareTo(V_9));
         }
         V_5 = V_5 + 1;
     }
     V_3  = Math.Max(first.get_Fields().get_Count(), second.get_Fields().get_Count());
     V_11 = 0;
     while (V_11 < V_3)
     {
         if (V_11 >= first.get_Fields().get_Count())
         {
             return(1);
         }
         if (V_11 >= second.get_Fields().get_Count())
         {
             return(-1);
         }
         V_12 = first.get_Fields().get_Item(V_11);
         V_13 = second.get_Fields().get_Item(V_11);
         if (!String.op_Equality(V_12.get_Name(), V_13.get_Name()))
         {
             return(V_12.get_Name().CompareTo(V_13.get_Name()));
         }
         V_10 = V_12.get_Argument();
         V_14 = V_10.get_Value().ToString();
         V_10 = V_13.get_Argument();
         V_15 = V_10.get_Value().ToString();
         if (String.op_Inequality(V_14, V_15))
         {
             return(V_14.CompareTo(V_15));
         }
         V_11 = V_11 + 1;
     }
     return(0);
 }
        private bool TryProcessConditionalDisposeHandler(YieldExceptionHandlerInfo yieldExceptionHandler, CFGBlockLogicalConstruct startBlock)
        {
            if (this.finallyBlocks.get_Count() > 0)
            {
                return(false);
            }
            if (startBlock as PartialCFGBlockLogicalConstruct == null || startBlock.get_CFGSuccessors().get_Count() != 1)
            {
                return(false);
            }
            if (startBlock.get_LogicalConstructExpressions().get_Count() == 0)
            {
                return(false);
            }
            V_0 = startBlock.get_LogicalConstructExpressions().get_Item(0) as BinaryExpression;
            if (V_0 == null || !V_0.get_IsAssignmentExpression() || V_0.get_Left().get_CodeNodeType() != 30 || (V_0.get_Left() as FieldReferenceExpression).get_Field().Resolve() != this.stateFieldRef || V_0.get_Right().get_CodeNodeType() != 22 || (Int32)(V_0.get_Right() as LiteralExpression).get_Value() != yieldExceptionHandler.get_NextState())
            {
                return(false);
            }
            if (startBlock.get_LogicalConstructExpressions().get_Count() != 2 || yieldExceptionHandler.get_HandlerType() != 2)
            {
                if (startBlock.get_LogicalConstructExpressions().get_Count() != 1 || yieldExceptionHandler.get_HandlerType() != 1)
                {
                    return(false);
                }
            }
            else
            {
                V_6 = startBlock.get_LogicalConstructExpressions().get_Item(1) as BinaryExpression;
                if (V_6 == null || !V_6.get_IsAssignmentExpression() || V_6.get_Left().get_CodeNodeType() != 30 || (object)(V_6.get_Left() as FieldReferenceExpression).get_Field() != (object)yieldExceptionHandler.get_DisposableField() || V_6.get_Right().get_CodeNodeType() != 33 || (V_6.get_Right() as SafeCastExpression).get_Expression().get_CodeNodeType() != 30 || (object)((V_6.get_Right() as SafeCastExpression).get_Expression() as FieldReferenceExpression).get_Field() != (object)yieldExceptionHandler.get_EnumeratorField())
                {
                    return(false);
                }
            }
            V_2 = startBlock.get_CFGSuccessors().GetEnumerator();
            V_7 = V_2;
            try
            {
                dummyVar0 = V_2.MoveNext();
                V_1       = V_2.get_Current();
            }
            finally
            {
                if (V_7 != null)
                {
                    V_7.Dispose();
                }
            }
            if (V_1.get_LogicalConstructExpressions().get_Count() != 1)
            {
                return(false);
            }
            V_3 = V_1.get_LogicalConstructExpressions().get_Item(0) as BinaryExpression;
            if (V_3 == null || V_3.get_Operator() != 9 || V_3.get_Left().get_CodeNodeType() != 30 || (object)(V_3.get_Left() as FieldReferenceExpression).get_Field() != (object)yieldExceptionHandler.get_DisposableField() || V_3.get_Right().get_CodeNodeType() != 22 || (V_3.get_Right() as LiteralExpression).get_Value() != null)
            {
                return(false);
            }
            V_4 = null;
            V_8 = V_1.get_CFGSuccessors().GetEnumerator();
            try
            {
                while (V_8.MoveNext())
                {
                    V_9 = V_8.get_Current() as CFGBlockLogicalConstruct;
                    if (V_9 == null || V_9.get_CFGPredecessors().get_Count() != 1)
                    {
                        continue;
                    }
                    V_4 = V_9;
                    goto Label0;
                }
            }
            finally
            {
                ((IDisposable)V_8).Dispose();
            }
Label0:
            if (V_4 == null || V_4.get_LogicalConstructExpressions().get_Count() != 1)
            {
                return(false);
            }
            V_5 = V_4.get_LogicalConstructExpressions().get_Item(0) as MethodInvocationExpression;
            if (V_5 == null || !V_5.get_VirtualCall() || V_5.get_MethodExpression().get_Target().get_CodeNodeType() != 30 || (object)(V_5.get_MethodExpression().get_Target() as FieldReferenceExpression).get_Field() != (object)yieldExceptionHandler.get_DisposableField() || String.op_Inequality(V_5.get_MethodExpression().get_Method().get_Name(), "Dispose"))
            {
                return(false);
            }
            this.finallyEntryBlock = startBlock;
            dummyVar1             = this.finallyBlocks.Add(startBlock);
            this.conditionBlock   = V_1;
            dummyVar2             = this.finallyBlocks.Add(V_1);
            this.disposeCallBlock = V_4;
            dummyVar3             = this.finallyBlocks.Add(V_4);
            return(true);
        }
Ejemplo n.º 24
0
 private bool TryTransformTernary(ConditionExpression ternary, out Expression transformed)
 {
     transformed = null;
     V_2         = ternary.get_Then() as LiteralExpression;
     V_3         = ternary.get_Else() as LiteralExpression;
     if (V_2 != null && V_3 != null)
     {
         V_14 = false;
         V_15 = false;
         if (!String.op_Equality(V_2.get_ExpressionType().get_FullName(), "System.Int32") || !String.op_Equality(V_3.get_ExpressionType().get_FullName(), "System.Int32"))
         {
             if (String.op_Equality(V_2.get_ExpressionType().get_FullName(), "System.Boolean") && String.op_Equality(V_3.get_ExpressionType().get_FullName(), "System.Boolean"))
             {
                 V_18 = (Boolean)V_2.get_Value();
                 V_19 = (Boolean)V_3.get_Value();
                 if (!V_18 && V_19 || V_18 && !V_19)
                 {
                     V_14 = true;
                     if (!V_18 && V_19)
                     {
                         V_15 = true;
                     }
                 }
             }
         }
         else
         {
             V_16 = (Int32)V_2.get_Value();
             V_17 = (Int32)V_3.get_Value();
             if (V_16 == 0 && V_17 == 1 || V_16 == 1 && V_17 == 0)
             {
                 V_14 = true;
                 if (V_16 == 0 && V_17 == 1)
                 {
                     V_15 = true;
                 }
             }
         }
         if (V_14)
         {
             if (!V_15)
             {
                 transformed = this.Transform(ternary.get_Condition());
             }
             else
             {
                 transformed = this.Transform(Negator.Negate(ternary.get_Condition(), this.typeSystem));
             }
             return(true);
         }
     }
     if (V_2 == null)
     {
         if (V_3 == null)
         {
             V_20 = ternary.get_Then() as ExplicitCastExpression;
             V_21 = ternary.get_Else() as ExplicitCastExpression;
             if (V_20 == null || V_21 == null || !String.op_Equality(V_20.get_TargetType().get_FullName(), "System.Int32") || !String.op_Equality(V_20.get_Expression().get_ExpressionType().get_FullName(), "System.Boolean") || !String.op_Equality(V_21.get_TargetType().get_FullName(), "System.Int32") || !String.op_Equality(V_21.get_Expression().get_ExpressionType().get_FullName(), "System.Boolean"))
             {
                 return(false);
             }
             ternary.set_Then(V_20.get_Expression());
             ternary.set_Else(V_21.get_Expression());
             transformed = ternary;
             return(true);
         }
         V_0 = V_3;
         V_1 = false;
     }
     else
     {
         V_0 = V_2;
         V_1 = true;
     }
     if (!String.op_Equality(V_0.get_ExpressionType().get_FullName(), "System.Int32"))
     {
         if (!String.op_Equality(V_0.get_ExpressionType().get_FullName(), "System.Boolean"))
         {
             return(false);
         }
         V_4 = (Boolean)V_0.get_Value();
     }
     else
     {
         if ((Int32)V_0.get_Value() != 0)
         {
             stackVariable163 = true;
         }
         else
         {
             stackVariable163 = false;
         }
         V_4 = stackVariable163;
     }
     V_6 = null;
     V_7 = null;
     V_6 = this.Transform(ternary.get_Condition());
     if (!V_1)
     {
         V_8 = ternary.get_Then();
     }
     else
     {
         V_8 = ternary.get_Else();
     }
     V_9  = V_8 as ConditionExpression;
     V_10 = V_8 as ExplicitCastExpression;
     V_11 = null;
     V_12 = false;
     if (V_9 == null && V_10 == null || String.op_Inequality(V_10.get_TargetType().get_FullName(), "System.Int32") || String.op_Inequality(V_10.get_Expression().get_ExpressionType().get_FullName(), "System.Boolean") && !this.IsBinaryExpression(V_8, out V_11, out V_12) && String.op_Inequality(V_8.get_ExpressionType().get_FullName(), "System.Boolean"))
     {
         return(false);
     }
     V_13 = false;
     if (V_10 == null)
     {
         if (V_11 == null)
         {
             if (V_9 != null && this.TryTransformTernary(V_9, out V_7))
             {
                 V_13 = true;
             }
         }
         else
         {
             V_22 = TransformCatchClausesFilterExpressionStep.GetBinaryExpression(V_12, V_11);
             if (this.TryTransformBinary(V_22))
             {
                 V_7  = TransformCatchClausesFilterExpressionStep.GetResultExpression(V_12, V_11, V_22);
                 V_13 = true;
             }
         }
     }
     else
     {
         V_7  = V_10.get_Expression();
         V_13 = true;
     }
     if (!V_13)
     {
         V_7 = V_8;
     }
     if (V_6 == null || V_7 == null)
     {
         return(false);
     }
     if (!V_4)
     {
         V_5 = 12;
         if (V_1)
         {
             stackVariable97 = Negator.Negate(V_6, this.typeSystem);
         }
         else
         {
             stackVariable97 = V_6;
         }
         V_6 = stackVariable97;
     }
     else
     {
         V_5 = 11;
         if (V_1)
         {
             stackVariable111 = V_6;
         }
         else
         {
             stackVariable111 = Negator.Negate(V_6, this.typeSystem);
         }
         V_6 = stackVariable111;
     }
     transformed = new BinaryExpression(V_5, V_6, V_7, this.typeSystem, ternary.get_MappedInstructions(), false);
     return(true);
 }
Ejemplo n.º 25
0
 protected override void InlineInBlocks()
 {
     V_0 = this.methodContext.get_Expressions().get_BlockExpressions().GetEnumerator();
     try
     {
         while (V_0.MoveNext())
         {
             V_1 = V_0.get_Current();
             V_2 = V_1.get_Value();
             V_3 = new Boolean[V_2.get_Count()];
             V_4 = (int)this.methodContext.get_ControlFlowGraph().get_InstructionToBlockMapping().get_Item(V_1.get_Key()).get_Successors().Length > 1;
             V_5 = V_2.get_Count() - 2;
             V_6 = V_5 + 1;
             while (V_5 >= 0)
             {
                 V_7 = V_2.get_Item(V_5) as BinaryExpression;
                 if (V_7 == null || !V_7.get_IsAssignmentExpression() || V_7.get_Left().get_CodeNodeType() != 26)
                 {
                     V_6 = V_5;
                 }
                 else
                 {
                     V_8 = (V_7.get_Left() as VariableReferenceExpression).get_Variable().Resolve();
                     if (this.variablesToInline.Contains(V_8))
                     {
                         V_9 = V_7.get_Right();
                         if (this.IsEnumeratorGetCurrent(V_9) || this.IsQueryInvocation(V_9) || V_8.get_VariableType() != null && V_8.get_VariableType().get_IsPinned())
                         {
                             V_6 = V_5;
                         }
                         else
                         {
                             V_10 = new List <Instruction>(V_7.get_MappedInstructions());
                             V_10.AddRange(V_7.get_Left().get_UnderlyingSameMethodInstructions());
                             stackVariable78 = this.inliner;
                             stackVariable79 = V_8;
                             stackVariable82 = V_9.CloneAndAttachInstructions(V_10);
                             stackVariable85 = V_2.get_Item(V_6);
                             if (!V_4)
                             {
                                 stackVariable87 = false;
                             }
                             else
                             {
                                 stackVariable87 = V_6 + 1 == V_2.get_Count();
                             }
                             if (!stackVariable78.TryInlineVariable(stackVariable79, stackVariable82, stackVariable85, stackVariable87, out V_11))
                             {
                                 V_6 = V_5;
                             }
                             else
                             {
                                 V_2.set_Item(V_6, (Expression)V_11);
                                 V_3[V_5] = true;
                             }
                         }
                     }
                     else
                     {
                         V_6 = V_5;
                     }
                 }
                 V_5 = V_5 - 1;
             }
             this.FastRemoveExpressions(V_2, V_3);
         }
     }
     finally
     {
         ((IDisposable)V_0).Dispose();
     }
     return;
 }
Ejemplo n.º 26
0
		public override void ExpandView(MixCmsContext _context = null, IDbContextTransaction _transaction = null)
		{
			V_0 = new SyncViewModel.u003cu003ec__DisplayClass178_0();
			V_0.u003cu003e4__this = this;
			V_0._context = _context;
			V_0._transaction = _transaction;
			if (this.get_Id() == 0)
			{
				this.set_ExtraFields(MixService.GetConfig<string>("DefaultPostAttr"));
			}
			this.set_Cultures(this.LoadCultures(this.get_Specificulture(), V_0._context, V_0._transaction));
			this.set_UrlAliases(this.GetAliases(V_0._context, V_0._transaction));
			if (!string.IsNullOrEmpty(this.get_Tags()))
			{
				this.set_ListTag(JArray.Parse(this.get_Tags()));
			}
			this.set_Columns(new List<ModuleFieldViewModel>());
			if (!string.IsNullOrEmpty(this.get_ExtraFields()))
			{
				stackVariable35 = JArray.Parse(this.get_ExtraFields());
			}
			else
			{
				stackVariable35 = new JArray();
			}
			V_5 = stackVariable35.GetEnumerator();
			try
			{
				while (V_5.MoveNext())
				{
					V_6 = V_5.get_Current();
					stackVariable41 = new ModuleFieldViewModel();
					stackVariable41.set_Name(CommonHelper.ParseJsonPropertyName(V_6.get_Item("name").ToString()));
					stackVariable49 = V_6.get_Item("title");
					if (stackVariable49 != null)
					{
						stackVariable50 = stackVariable49.ToString();
					}
					else
					{
						dummyVar0 = stackVariable49;
						stackVariable50 = null;
					}
					stackVariable41.set_Title(stackVariable50);
					if (V_6.get_Item("options") != null)
					{
						stackVariable57 = Newtonsoft.Json.Linq.Extensions.Value<JArray>(V_6.get_Item("options"));
					}
					else
					{
						stackVariable57 = new JArray();
					}
					stackVariable41.set_Options(stackVariable57);
					if (V_6.get_Item("priority") != null)
					{
						stackVariable64 = Newtonsoft.Json.Linq.Extensions.Value<int>(V_6.get_Item("priority"));
					}
					else
					{
						stackVariable64 = 0;
					}
					stackVariable41.set_Priority(stackVariable64);
					stackVariable41.set_DataType(JToken.op_Explicit(V_6.get_Item("dataType")));
					if (V_6.get_Item("width") != null)
					{
						stackVariable75 = Newtonsoft.Json.Linq.Extensions.Value<int>(V_6.get_Item("width"));
					}
					else
					{
						stackVariable75 = 3;
					}
					stackVariable41.set_Width(stackVariable75);
					if (V_6.get_Item("isUnique") != null)
					{
						stackVariable82 = Newtonsoft.Json.Linq.Extensions.Value<bool>(V_6.get_Item("isUnique"));
					}
					else
					{
						stackVariable82 = true;
					}
					stackVariable41.set_IsUnique(stackVariable82);
					if (V_6.get_Item("isRequired") != null)
					{
						stackVariable89 = Newtonsoft.Json.Linq.Extensions.Value<bool>(V_6.get_Item("isRequired"));
					}
					else
					{
						stackVariable89 = true;
					}
					stackVariable41.set_IsRequired(stackVariable89);
					if (V_6.get_Item("isDisplay") != null)
					{
						stackVariable96 = Newtonsoft.Json.Linq.Extensions.Value<bool>(V_6.get_Item("isDisplay"));
					}
					else
					{
						stackVariable96 = true;
					}
					stackVariable41.set_IsDisplay(stackVariable96);
					if (V_6.get_Item("isSelect") != null)
					{
						stackVariable103 = Newtonsoft.Json.Linq.Extensions.Value<bool>(V_6.get_Item("isSelect"));
					}
					else
					{
						stackVariable103 = false;
					}
					stackVariable41.set_IsSelect(stackVariable103);
					if (V_6.get_Item("isGroupBy") != null)
					{
						stackVariable110 = Newtonsoft.Json.Linq.Extensions.Value<bool>(V_6.get_Item("isGroupBy"));
					}
					else
					{
						stackVariable110 = false;
					}
					stackVariable41.set_IsGroupBy(stackVariable110);
					this.get_Columns().Add(stackVariable41);
				}
			}
			finally
			{
				if (V_5 != null)
				{
					V_5.Dispose();
				}
			}
			this.set_Properties(new List<ExtraProperty>());
			if (!string.IsNullOrEmpty(this.get_ExtraProperties()))
			{
				V_5 = JArray.Parse(this.get_ExtraProperties()).GetEnumerator();
				try
				{
					while (V_5.MoveNext())
					{
						V_8 = V_5.get_Current();
						this.get_Properties().Add(V_8.ToObject<ExtraProperty>());
					}
				}
				finally
				{
					if (V_5 != null)
					{
						V_5.Dispose();
					}
				}
			}
			stackVariable121 = this.get_Templates();
			if (stackVariable121 == null)
			{
				dummyVar1 = stackVariable121;
				stackVariable686 = ViewModelBase<MixCmsContext, MixTemplate, Mix.Cms.Lib.ViewModels.MixTemplates.UpdateViewModel>.Repository;
				V_9 = Expression.Parameter(System.Type.GetTypeFromHandle(// 
Ejemplo n.º 27
0
 private void RedirectConstraints()
 {
     V_0 = new List <KeyValuePair <ClassHierarchyNode, ClassHierarchyNode> >();
     V_1 = this.get_ContainedNodes().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current();
             V_3 = V_2.get_CanAssignTo().GetEnumerator();
             try
             {
                 while (V_3.MoveNext())
                 {
                     V_4 = V_3.get_Current();
                     if (this.get_ContainedNodes().Contains(V_4))
                     {
                         continue;
                     }
                     if (!V_4.get_IsHardNode() || !V_4.get_NodeType().get_IsPrimitive() || !V_2.get_IsHardNode() || this.IsAssignable(V_2.get_NodeType(), V_4.get_NodeType()))
                     {
                         V_0.Add(new KeyValuePair <ClassHierarchyNode, ClassHierarchyNode>(V_2, V_4));
                     }
                     else
                     {
                         dummyVar0 = V_4.get_SubTypes().Remove(V_2);
                     }
                 }
             }
             finally
             {
                 if (V_3 != null)
                 {
                     V_3.Dispose();
                 }
             }
         }
     }
     finally
     {
         if (V_1 != null)
         {
             V_1.Dispose();
         }
     }
     V_5 = V_0.GetEnumerator();
     try
     {
         while (V_5.MoveNext())
         {
             V_6 = V_5.get_Current();
             V_7 = V_6.get_Key();
             V_8 = V_6.get_Value();
             this.get_CanAssignTo().Add(V_8);
             dummyVar1 = V_7.get_CanAssignTo().Remove(V_8);
             dummyVar2 = V_8.get_SubTypes().Remove(V_7);
             if (V_8.get_SubTypes().Contains(this))
             {
                 continue;
             }
             V_8.get_SubTypes().Add(this);
         }
     }
     finally
     {
         ((IDisposable)V_5).Dispose();
     }
     V_0 = new List <KeyValuePair <ClassHierarchyNode, ClassHierarchyNode> >();
     V_1 = this.get_ContainedNodes().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_9 = V_1.get_Current();
             V_3 = V_9.get_SubTypes().GetEnumerator();
             try
             {
                 while (V_3.MoveNext())
                 {
                     V_10 = V_3.get_Current();
                     if (this.get_ContainedNodes().Contains(V_10))
                     {
                         continue;
                     }
                     if (!V_10.get_IsHardNode() || !V_10.get_NodeType().get_IsPrimitive() || !V_9.get_IsHardNode() || this.IsAssignable(V_10.get_NodeType(), V_9.get_NodeType()))
                     {
                         V_0.Add(new KeyValuePair <ClassHierarchyNode, ClassHierarchyNode>(V_9, V_10));
                     }
                     else
                     {
                         dummyVar3 = V_10.get_CanAssignTo().Remove(V_9);
                     }
                 }
             }
             finally
             {
                 if (V_3 != null)
                 {
                     V_3.Dispose();
                 }
             }
         }
     }
     finally
     {
         if (V_1 != null)
         {
             V_1.Dispose();
         }
     }
     V_5 = V_0.GetEnumerator();
     try
     {
         while (V_5.MoveNext())
         {
             V_11 = V_5.get_Current();
             V_12 = V_11.get_Key();
             V_13 = V_11.get_Value();
             this.get_SubTypes().Add(V_13);
             dummyVar4 = V_12.get_SubTypes().Remove(V_13);
             dummyVar5 = V_13.get_CanAssignTo().Remove(V_12);
             if (V_13.get_CanAssignTo().Contains(this))
             {
                 continue;
             }
             V_13.get_CanAssignTo().Add(this);
         }
     }
     finally
     {
         ((IDisposable)V_5).Dispose();
     }
     return;
 }
Ejemplo n.º 28
0
 private bool TryMatchInternal(StatementCollection statements, int startIndex, out Statement result)
 {
     result = null;
     if (startIndex + 1 >= statements.get_Count())
     {
         return(false);
     }
     if (statements.get_Item(startIndex).get_CodeNodeType() != 5 || statements.get_Item(startIndex + 1).get_CodeNodeType() != 3)
     {
         return(false);
     }
     V_0 = statements.get_Item(startIndex) as ExpressionStatement;
     if (V_0.get_Expression().get_CodeNodeType() != 24)
     {
         return(false);
     }
     V_1 = V_0.get_Expression() as BinaryExpression;
     if (V_1.get_Left().get_CodeNodeType() != 26 || V_1.get_Right().get_CodeNodeType() != 48)
     {
         return(false);
     }
     V_2 = V_1.get_Left() as VariableReferenceExpression;
     V_3 = V_1.get_Right() as EventReferenceExpression;
     V_4 = statements.get_Item(startIndex + 1) as IfStatement;
     if (V_4.get_Then() == null || V_4.get_Else() != null || V_4.get_Condition().get_CodeNodeType() != 24)
     {
         return(false);
     }
     V_5 = V_4.get_Condition() as BinaryExpression;
     if (V_5.get_Left().get_CodeNodeType() != 26 || V_5.get_Right().get_CodeNodeType() != 22 || V_5.get_Operator() != 10)
     {
         return(false);
     }
     V_6 = V_5.get_Left() as VariableReferenceExpression;
     if ((object)V_2.get_Variable() != (object)V_6.get_Variable())
     {
         return(false);
     }
     if ((V_5.get_Right() as LiteralExpression).get_Value() != null)
     {
         return(false);
     }
     V_7 = V_4.get_Then().get_Statements();
     if (V_7.get_Count() != 1 || V_7.get_Item(0).get_CodeNodeType() != 5)
     {
         return(false);
     }
     V_8 = V_7.get_Item(0) as ExpressionStatement;
     if (V_8.get_Expression().get_CodeNodeType() != 51)
     {
         return(false);
     }
     V_9 = V_8.get_Expression() as DelegateInvokeExpression;
     if (V_9.get_Target() == null || V_9.get_Target().get_CodeNodeType() != 26)
     {
         return(false);
     }
     V_10 = V_9.get_Target() as VariableReferenceExpression;
     if ((object)V_10.get_Variable() != (object)V_2.get_Variable())
     {
         return(false);
     }
     V_11 = new List <Instruction>();
     V_11.AddRange(V_0.get_UnderlyingSameMethodInstructions());
     V_11.AddRange(V_5.get_UnderlyingSameMethodInstructions());
     V_11.AddRange(V_9.get_MappedInstructions());
     V_11.AddRange(V_10.get_UnderlyingSameMethodInstructions());
     result = new ExpressionStatement(new RaiseEventExpression(V_3.get_Event(), V_9.get_InvokeMethodReference(), V_9.get_Arguments(), V_11));
     return(true);
 }
Ejemplo n.º 29
0
		private ICodeNode FixBranchingExpression(Expression expression, Instruction branch)
		{
			if (branch.get_OpCode().get_Code() == 57)
			{
				stackVariable5 = true;
			}
			else
			{
				V_5 = branch.get_OpCode();
				stackVariable5 = V_5.get_Code() == 44;
			}
			V_0 = stackVariable5;
			V_1 = expression.get_ExpressionType();
			V_3 = 9;
			stackVariable10 = new Instruction[1];
			stackVariable10[0] = branch;
			V_4 = stackVariable10;
			if (V_0)
			{
				V_3 = 10;
			}
			if (String.op_Equality(V_1.get_Name(), "Boolean") || V_1.get_Name().Contains("Boolean "))
			{
				if (V_0)
				{
					V_6 = expression;
				}
				else
				{
					V_6 = Negator.Negate(expression, this.typeSystem);
				}
				if (expression as SafeCastExpression == null)
				{
					V_7 = new UnaryExpression(11, V_6, V_4);
				}
				else
				{
					V_7 = new BinaryExpression(V_3, expression, this.GetLiteralExpression(false, null), this.typeSystem, V_4, false);
				}
				return V_7;
			}
			if (String.op_Equality(V_1.get_Name(), "Char"))
			{
				V_2 = new BinaryExpression(V_3, expression, this.GetLiteralExpression('\0', null), this.typeSystem, V_4, false);
				V_2.set_ExpressionType(this.typeSystem.get_Boolean());
			}
			if (V_1.get_IsPrimitive())
			{
				V_2 = new BinaryExpression(V_3, expression, this.GetLiteralExpression(0, null), this.typeSystem, V_4, false);
				V_2.set_ExpressionType(this.typeSystem.get_Boolean());
			}
			else
			{
				V_8 = V_1.Resolve();
				if (V_8 == null || !V_8.get_IsEnum() || V_1.get_IsArray())
				{
					V_2 = new BinaryExpression(V_3, expression, this.GetLiteralExpression(null, null), this.typeSystem, V_4, false);
					V_2.set_ExpressionType(this.typeSystem.get_Boolean());
				}
				else
				{
					V_9 = null;
					V_10 = V_8.get_Fields().GetEnumerator();
					try
					{
						while (V_10.MoveNext())
						{
							V_11 = V_10.get_Current();
							if (V_11.get_Constant() == null || V_11.get_Constant().get_Value() == null || !V_11.get_Constant().get_Value().Equals(0))
							{
								continue;
							}
							V_9 = V_11;
							goto Label0;
						}
					}
					finally
					{
						V_10.Dispose();
					}
				Label0:
					if (V_9 != null)
					{
						V_2 = new BinaryExpression(V_3, expression, new EnumExpression(V_9, null), this.typeSystem, V_4, false);
						V_2.set_ExpressionType(this.typeSystem.get_Boolean());
					}
					else
					{
						V_2 = new BinaryExpression(V_3, expression, this.GetLiteralExpression(0, null), this.typeSystem, V_4, false);
						V_2.set_ExpressionType(this.typeSystem.get_Boolean());
					}
				}
			}
			return V_2;
		}