private void MapBlocks()
 {
     V_0 = this.logicalBuilderContext.get_CFG().get_Blocks();
     V_1 = 0;
     while (V_1 < (int)V_0.Length)
     {
         V_2                = V_0[V_1];
         V_3                = V_2.get_First().get_Offset();
         stackVariable17    = this.logicalBuilderContext.get_CFGBlockToLogicalConstructMap();
         stackVariable20    = new CFGBlockLogicalConstruct[1];
         stackVariable20[0] = new CFGBlockLogicalConstruct(V_2, this.methodContext.get_Expressions().get_BlockExpressions().get_Item(V_3));
         stackVariable17.Add(V_2, stackVariable20);
         V_1 = V_1 + 1;
     }
     V_0 = this.logicalBuilderContext.get_CFG().get_Blocks();
     V_1 = 0;
     while (V_1 < (int)V_0.Length)
     {
         V_4 = V_0[V_1];
         V_5 = this.logicalBuilderContext.get_CFGBlockToLogicalConstructMap().get_Item(V_4)[0];
         V_6 = V_4.get_Successors();
         V_7 = 0;
         while (V_7 < (int)V_6.Length)
         {
             V_8 = V_6[V_7];
             V_9 = this.logicalBuilderContext.get_CFGBlockToLogicalConstructMap().get_Item(V_8)[0];
             V_5.AddToSuccessors(V_9);
             V_9.AddToPredecessors(V_5);
             V_7 = V_7 + 1;
         }
         V_1 = V_1 + 1;
     }
     return;
 }
 private ConditionLogicalConstruct CreateComplexCondition(ConditionLogicalConstruct conditionNode)
 {
     V_0       = conditionNode.get_ConditionExpression();
     V_1       = new HashSet <ILogicalConstruct>();
     V_2       = conditionNode;
     dummyVar0 = V_1.Add(V_2);
     V_3       = V_2.get_TrueSuccessor();
     V_4       = V_2.get_FalseSuccessor();
     while (true)
     {
         if (!this.CanBePartOfComplexCondition(V_3, V_1, V_2.get_FalseCFGSuccessor()))
         {
             if (!this.CanBePartOfComplexCondition(V_4, V_1, V_2.get_TrueCFGSuccessor()))
             {
                 break;
             }
             V_6 = V_4 as ConditionLogicalConstruct;
             if (V_6.get_TrueSuccessor() != V_3)
             {
                 V_6.Negate(this.typeSystem);
             }
             V_8 = 11;
         }
         else
         {
             V_6 = V_3 as ConditionLogicalConstruct;
             if (V_6.get_FalseSuccessor() != V_4)
             {
                 V_6.Negate(this.typeSystem);
             }
             V_8 = 12;
         }
         V_0 = new BinaryExpression(V_8, V_0, V_6.get_ConditionExpression(), this.typeSystem, null, false);
         V_0.set_ExpressionType(this.booleanTypeReference);
         V_2       = V_6;
         V_3       = V_2.get_TrueSuccessor();
         V_4       = V_2.get_FalseSuccessor();
         dummyVar1 = V_1.Add(V_2);
     }
     if (V_1.get_Count() == 1)
     {
         return(conditionNode);
     }
     V_5 = new HashSet <ConditionLogicalConstruct>();
     V_9 = V_1.GetEnumerator();
     try
     {
         while (V_9.MoveNext())
         {
             V_10      = (ConditionLogicalConstruct)V_9.get_Current();
             dummyVar2 = V_5.Add(V_10);
         }
     }
     finally
     {
         ((IDisposable)V_9).Dispose();
     }
     return(new ConditionLogicalConstruct(conditionNode, V_2, V_5, V_0));
 }
Exemple #3
0
 protected override bool TryMatchInternal(StatementCollection statements, int startIndex, out Statement result, out int replacedStatementsCount)
 {
     result = null;
     replacedStatementsCount = 0;
     if (!this.TryGetArrayCreation(statements, startIndex, out V_0, out V_1))
     {
         return(false);
     }
     if (V_0.get_Initializer() != null && V_0.get_Initializer().get_Expressions().get_Count() != 0)
     {
         return(false);
     }
     V_2 = this.GetCreatedArraySize(V_0);
     V_3 = new Dictionary <uint, Expression>();
     V_4 = (long)-1;
     V_7 = startIndex + 1;
     while (V_7 < statements.get_Count() && this.TryGetNextExpression(statements.get_Item(V_7), out V_8))
     {
         V_9 = (statements.get_Item(V_7) as ExpressionStatement).get_Expression() as BinaryExpression;
         if (!this.IsArrayElementAssignment(V_9, V_1))
         {
             break;
         }
         V_10 = this.GetAssignmentIndex(V_9.get_Left());
         if (V_10 >= V_2 || (ulong)V_10 <= V_4)
         {
             break;
         }
         V_11 = new List <Instruction>(V_9.get_Left().get_UnderlyingSameMethodInstructions());
         V_11.AddRange(V_9.get_MappedInstructions());
         V_3.set_Item(V_10, V_9.get_Right().CloneAndAttachInstructions(V_11));
         V_4 = (ulong)V_10;
         V_7 = V_7 + 1;
     }
     if (V_3.get_Count() == 0 || (ulong)V_2 - (long)V_3.get_Count() > (long)10)
     {
         return(false);
     }
     V_5  = V_0.get_ElementType();
     V_6  = new ExpressionCollection();
     V_12 = 0;
     while (V_12 < V_2)
     {
         if (V_3.ContainsKey(V_12))
         {
             V_13 = V_3.get_Item(V_12);
         }
         else
         {
             V_13 = this.GetTypeDefaultLiteralExpression(V_5);
         }
         V_6.Add(V_13);
         V_12 = V_12 + 1;
     }
     V_0.set_Initializer(new InitializerExpression(V_6, 2));
     result = statements.get_Item(startIndex);
     replacedStatementsCount = V_3.get_Count() + 1;
     return(true);
 }
 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;
 }
 private HashSet <ILogicalConstruct> GetLogicalConstructsInRange(BlockRange blockRange, out ILogicalConstruct theCommonParent)
 {
     V_0 = new HashSet <ILogicalConstruct>();
     V_1 = new HashSet <ISingleEntrySubGraph>();
     V_2 = blockRange.Start.get_First().get_Offset();
     V_3 = blockRange.End.get_First().get_Offset();
     V_5 = 0;
     while (V_5 < (int)this.context.get_CFG().get_Blocks().Length)
     {
         V_6 = this.context.get_CFG().get_Blocks()[V_5];
         if (V_6.get_First().get_Offset() >= V_2 && V_6.get_First().get_Offset() <= V_3)
         {
             V_7 = this.context.get_CFGBlockToLogicalConstructMap().get_Item(V_6);
             V_8 = 0;
             while (V_8 < (int)V_7.Length)
             {
                 dummyVar0 = V_1.Add((ILogicalConstruct)V_7[V_8].get_Parent());
                 dummyVar1 = V_0.Add(V_7[V_8]);
                 V_8       = V_8 + 1;
             }
         }
         V_5 = V_5 + 1;
     }
     if (V_1.get_Count() == 1)
     {
         theCommonParent = (ILogicalConstruct)V_1.ToArray <ISingleEntrySubGraph>()[0];
         return(V_0);
     }
     theCommonParent = (ILogicalConstruct)LogicalFlowUtilities.FindFirstCommonParent(V_1);
     V_4             = new HashSet <ILogicalConstruct>();
     V_9             = V_0.GetEnumerator();
     try
     {
         while (V_9.MoveNext())
         {
             dummyVar2 = LogicalFlowUtilities.TryGetParentConstructWithGivenParent(V_9.get_Current(), theCommonParent, out V_10);
             dummyVar3 = V_4.Add(V_10);
         }
     }
     finally
     {
         ((IDisposable)V_9).Dispose();
     }
     if (theCommonParent as ExceptionHandlingLogicalConstruct != null)
     {
         V_4.Clear();
         dummyVar4       = V_4.Add(theCommonParent);
         theCommonParent = theCommonParent.get_Parent() as ILogicalConstruct;
     }
     return(V_4);
 }
 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;
 }
Exemple #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));
 }
Exemple #8
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);
 }
Exemple #9
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;
		}
		public static ICollection<TypeReference> GetAssemblyAttributesUsedTypes(AssemblyDefinition assembly)
		{
			V_0 = new List<TypeReference>();
			V_1 = new List<ICustomAttribute>();
			V_1.Add(AttributesUtilities.GetAssemblyVersionAttribute(assembly));
			V_3 = assembly.get_CustomAttributes().GetEnumerator();
			try
			{
				while (V_3.MoveNext())
				{
					V_4 = V_3.get_Current();
					V_4.Resolve();
					V_1.Add(V_4);
				}
			}
			finally
			{
				V_3.Dispose();
			}
			if (assembly.get_HasSecurityDeclarations())
			{
				V_5 = assembly.get_SecurityDeclarations().GetEnumerator();
				try
				{
					while (V_5.MoveNext())
					{
						V_6 = V_5.get_Current();
						if (!V_6.get_HasSecurityAttributes())
						{
							continue;
						}
						V_7 = V_6.get_SecurityAttributes().GetEnumerator();
						try
						{
							while (V_7.MoveNext())
							{
								V_8 = V_7.get_Current();
								V_1.Add(V_8);
							}
						}
						finally
						{
							V_7.Dispose();
						}
					}
				}
				finally
				{
					V_5.Dispose();
				}
			}
			if (assembly.get_MainModule().get_HasExportedTypes())
			{
				V_9 = assembly.get_MainModule().get_ExportedTypes().GetEnumerator();
				try
				{
					while (V_9.MoveNext())
					{
						V_10 = V_9.get_Current();
						if (V_10.get_Scope() as ModuleReference != null)
						{
							continue;
						}
						V_1.Add(AttributesUtilities.GetExportedTypeAttribute(V_10, assembly.get_MainModule()));
					}
				}
				finally
				{
					V_9.Dispose();
				}
			}
			V_11 = V_1.GetEnumerator();
			try
			{
				while (V_11.MoveNext())
				{
					V_12 = V_11.get_Current();
					if (V_12 as CustomAttribute == null)
					{
						if (V_12 as SecurityAttribute == null)
						{
							continue;
						}
						V_13 = AttributesUtilities.GetSecurityAttributeUsedTypes(V_12 as SecurityAttribute).GetEnumerator();
						try
						{
							while (V_13.MoveNext())
							{
								V_15 = V_13.get_Current();
								V_0.Add(V_15);
							}
						}
						finally
						{
							if (V_13 != null)
							{
								V_13.Dispose();
							}
						}
					}
					else
					{
						V_13 = AttributesUtilities.GetCustomAttributeUsedTypes(V_12 as CustomAttribute).GetEnumerator();
						try
						{
							while (V_13.MoveNext())
							{
								V_14 = V_13.get_Current();
								V_0.Add(V_14);
							}
						}
						finally
						{
							if (V_13 != null)
							{
								V_13.Dispose();
							}
						}
					}
				}
			}
			finally
			{
				((IDisposable)V_11).Dispose();
			}
			return V_0;
		}
 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;
 }
Exemple #12
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;
 }
Exemple #13
0
        public static void LoadFromDatabase(MixCmsContext _context = null, IDbContextTransaction _transaction = null)
        {
            UnitOfWorkHelper <MixCmsContext> .InitTransaction(_context, _transaction, ref V_0, ref V_1, ref V_2);

            try
            {
                try
                {
                    MixService.get_Instance().set_Translator(new JObject());
                    V_3 = V_0.get_MixLanguage().ToList <MixLanguage>();
                    V_4 = V_0.get_MixCulture().ToList <MixCulture>();
                    V_6 = V_4.GetEnumerator();
                    try
                    {
                        while (V_6.MoveNext())
                        {
                            V_7             = new MixService.u003cu003ec__DisplayClass63_0();
                            V_7.culture     = V_6.get_Current();
                            V_8             = new JObject();
                            stackVariable22 = V_3;
                            stackVariable24 = V_7.u003cu003e9__0;
                            if (stackVariable24 == null)
                            {
                                dummyVar0          = stackVariable24;
                                stackVariable50    = new Func <MixLanguage, bool>(V_7.u003cLoadFromDatabaseu003eb__0);
                                V_10               = stackVariable50;
                                V_7.u003cu003e9__0 = stackVariable50;
                                stackVariable24    = V_10;
                            }
                            V_9 = stackVariable22.Where <MixLanguage>(stackVariable24).ToList <MixLanguage>().GetEnumerator();
                            try
                            {
                                while (V_9.MoveNext())
                                {
                                    V_11            = V_9.get_Current();
                                    stackVariable33 = V_11.get_Keyword();
                                    stackVariable35 = V_11.get_Value();
                                    if (stackVariable35 == null)
                                    {
                                        dummyVar1       = stackVariable35;
                                        stackVariable35 = V_11.get_DefaultValue();
                                    }
                                    V_8.Add(new JProperty(stackVariable33, stackVariable35));
                                }
                            }
                            finally
                            {
                                ((IDisposable)V_9).Dispose();
                            }
                            MixService.get_Instance().get_Translator().Add(new JProperty(V_7.culture.get_Specificulture(), V_8));
                        }
                    }
                    finally
                    {
                        ((IDisposable)V_6).Dispose();
                    }
                    MixService.get_Instance().set_LocalSettings(new JObject());
                    V_5 = V_0.get_MixConfiguration().ToList <MixConfiguration>();
                    V_6 = V_4.GetEnumerator();
                    try
                    {
                        while (V_6.MoveNext())
                        {
                            V_13            = new MixService.u003cu003ec__DisplayClass63_1();
                            V_13.culture    = V_6.get_Current();
                            V_14            = new JObject();
                            stackVariable65 = V_5;
                            stackVariable67 = V_13.u003cu003e9__1;
                            if (stackVariable67 == null)
                            {
                                dummyVar2           = stackVariable67;
                                stackVariable92     = new Func <MixConfiguration, bool>(V_13.u003cLoadFromDatabaseu003eb__1);
                                V_16                = stackVariable92;
                                V_13.u003cu003e9__1 = stackVariable92;
                                stackVariable67     = V_16;
                            }
                            V_15 = stackVariable65.Where <MixConfiguration>(stackVariable67).ToList <MixConfiguration>().GetEnumerator();
                            try
                            {
                                while (V_15.MoveNext())
                                {
                                    V_17 = V_15.get_Current();
                                    V_18 = new JProperty(V_17.get_Keyword(), V_17.get_Value());
                                    V_14.Add(V_18);
                                }
                            }
                            finally
                            {
                                ((IDisposable)V_15).Dispose();
                            }
                            MixService.get_Instance().get_LocalSettings().Add(new JProperty(V_13.culture.get_Specificulture(), V_14));
                        }
                    }
                    finally
                    {
                        ((IDisposable)V_6).Dispose();
                    }
                    UnitOfWorkHelper <MixCmsContext> .HandleTransaction(true, V_2, V_1);
                }
                catch (Exception exception_0)
                {
                    dummyVar3 = UnitOfWorkHelper <MixCmsContext> .HandleException <MixLanguage>(exception_0, V_2, V_1);
                }
            }
            finally
            {
                if (V_2)
                {
                    RelationalDatabaseFacadeExtensions.CloseConnection(V_0.get_Database());
                    V_1.Dispose();
                    V_0.Dispose();
                }
            }
            return;
        }
 protected override bool TryMatchInternal(StatementCollection statements, int startIndex, out Statement result, out int replacedStatementsCount)
 {
     result = null;
     replacedStatementsCount = 0;
     if (!this.TryGetObjectCreation(statements, startIndex, out V_0, out V_1))
     {
         return(false);
     }
     V_2 = new ExpressionCollection();
     V_3 = new HashSet <string>();
     if (V_0.get_Initializer() != null)
     {
         if (V_0.get_Initializer().get_InitializerType() != 1)
         {
             return(false);
         }
         V_4 = V_0.get_Initializer().get_Expressions().GetEnumerator();
         try
         {
             while (V_4.MoveNext())
             {
                 V_5       = V_4.get_Current();
                 V_6       = this.GetName((V_5 as BinaryExpression).get_Left());
                 dummyVar0 = V_3.Add(V_6);
             }
         }
         finally
         {
             if (V_4 != null)
             {
                 V_4.Dispose();
             }
         }
     }
     V_7 = startIndex + 1;
     while (V_7 < statements.get_Count() && this.TryGetNextExpression(statements.get_Item(V_7), out V_8))
     {
         V_9 = V_8 as BinaryExpression;
         if (!this.IsObjectPropertyOrFieldAssignment(V_9, V_1))
         {
             break;
         }
         V_10 = null;
         if (V_9.get_Left().get_CodeNodeType() != 42)
         {
             if (V_9.get_Left().get_CodeNodeType() == 30)
             {
                 V_13 = (V_9.get_Left() as FieldReferenceExpression).get_Field().Resolve();
                 if (!this.Visit(V_13.get_Name(), V_3))
                 {
                     break;
                 }
                 V_10 = new FieldInitializerExpression(V_13, V_13.get_FieldType(), V_9.get_Left().get_UnderlyingSameMethodInstructions());
             }
         }
         else
         {
             V_12 = (V_9.get_Left() as PropertyReferenceExpression).get_Property();
             if (!this.Visit(V_12.get_Name(), V_3))
             {
                 break;
             }
             V_10 = new PropertyInitializerExpression(V_12, V_12.get_PropertyType(), V_9.get_Left().get_UnderlyingSameMethodInstructions());
         }
         V_11 = new BinaryExpression(26, V_10, V_9.get_Right().Clone(), this.typeSystem, null, false);
         V_2.Add(V_11);
         V_7 = V_7 + 1;
     }
     if (V_2.get_Count() == 0)
     {
         return(false);
     }
     if (V_0.get_Initializer() != null)
     {
         V_4 = V_2.GetEnumerator();
         try
         {
             while (V_4.MoveNext())
             {
                 V_15 = V_4.get_Current();
                 V_0.get_Initializer().get_Expressions().Add(V_15);
             }
         }
         finally
         {
             if (V_4 != null)
             {
                 V_4.Dispose();
             }
         }
     }
     else
     {
         V_14 = new InitializerExpression(V_2, 1);
         V_14.set_IsMultiLine(true);
         V_0.set_Initializer(V_14);
     }
     result = statements.get_Item(startIndex);
     replacedStatementsCount = V_2.get_Count() + 1;
     return(true);
 }
        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());
        }
        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);
        }
Exemple #17
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;
 }
 private static bool TryMatchVariableDeclaration(BlockStatement filter, out VariableDeclarationExpression variableDeclaration)
 {
     variableDeclaration = null;
     V_0 = filter.get_Statements().get_Item(0) as ExpressionStatement;
     if (V_0 == null)
     {
         return(false);
     }
     V_1 = V_0.get_Expression() as BinaryExpression;
     if (V_1 == null || !V_1.get_IsAssignmentExpression())
     {
         return(false);
     }
     V_2 = V_1.get_Left() as VariableReferenceExpression;
     if (V_2 == null)
     {
         return(false);
     }
     if (V_1.get_Right() as SafeCastExpression == null)
     {
         return(false);
     }
     V_3 = filter.get_Statements().get_Item(1) as IfStatement;
     if (V_3 == null)
     {
         return(false);
     }
     V_4 = V_3.get_Condition() as BinaryExpression;
     if (V_4 == null)
     {
         return(false);
     }
     V_5 = V_4.get_Left() as VariableReferenceExpression;
     if (V_5 == null)
     {
         return(false);
     }
     V_6 = V_4.get_Right() as LiteralExpression;
     if (V_6 == null)
     {
         return(false);
     }
     if (!V_5.Equals(V_2) || V_6.get_Value() != null || V_4.get_Operator() != 9 && V_4.get_Operator() != 10)
     {
         return(false);
     }
     V_7 = V_2.get_Variable().Resolve();
     V_8 = V_2.get_MappedInstructions();
     if (V_4.get_Operator() != 10)
     {
         V_9 = V_3.get_Else();
     }
     else
     {
         V_9 = V_3.get_Then();
     }
     if (!CatchClausesFilterPattern.TryGetVariableDeclaration(V_9.get_Statements().get_Item(0) as ExpressionStatement, V_2, ref V_7, ref V_8) && V_9.get_Statements().get_Count() >= 2)
     {
         dummyVar0 = CatchClausesFilterPattern.TryGetVariableDeclaration(V_9.get_Statements().get_Item(1) as ExpressionStatement, V_2, ref V_7, ref V_8);
     }
     variableDeclaration = new VariableDeclarationExpression(V_7, V_8);
     return(true);
 }
Exemple #19
0
 protected override bool TryMatchInternal(StatementCollection statements, int startIndex, out Statement result, out int replacedStatementsCount)
 {
     result = null;
     replacedStatementsCount = 0;
     if (!this.TryGetObjectCreation(statements, startIndex, out V_0, out V_1))
     {
         return(false);
     }
     if (V_0.get_Initializer() != null && V_0.get_Initializer().get_InitializerType() != InitializerType.CollectionInitializer)
     {
         return(false);
     }
     if (!this.ImplementsInterface(V_0.get_Type(), "System.Collections.IEnumerable"))
     {
         return(false);
     }
     V_2 = new ExpressionCollection();
     V_3 = startIndex + 1;
     while (V_3 < statements.get_Count() && this.TryGetNextExpression(statements.get_Item(V_3), out V_4) && V_4.get_CodeNodeType() == 19)
     {
         V_5 = V_4 as MethodInvocationExpression;
         V_6 = V_5.get_MethodExpression().get_MethodDefinition();
         if (!this.CompareTargets(V_1, V_5.get_MethodExpression().get_Target()) || String.op_Inequality(V_6.get_Name(), "Add") || V_5.get_Arguments().get_Count() == 0)
         {
             break;
         }
         if (V_5.get_Arguments().get_Count() != 1)
         {
             stackVariable88 = V_5.get_Arguments();
             stackVariable89 = CollectionInitializationPattern.u003cu003ec.u003cu003e9__1_0;
             if (stackVariable89 == null)
             {
                 dummyVar0       = stackVariable89;
                 stackVariable89 = new Func <Expression, Expression>(CollectionInitializationPattern.u003cu003ec.u003cu003e9.u003cTryMatchInternalu003eb__1_0);
                 CollectionInitializationPattern.u003cu003ec.u003cu003e9__1_0 = stackVariable89;
             }
             V_7 = new BlockExpression(new ExpressionCollection(stackVariable88.Select <Expression, Expression>(stackVariable89)), null);
             V_2.Add(V_7);
         }
         else
         {
             V_2.Add(V_5.get_Arguments().get_Item(0).Clone());
         }
         V_3 = V_3 + 1;
     }
     if (V_2.get_Count() == 0)
     {
         return(false);
     }
     if (V_0.get_Initializer() != null)
     {
         V_9 = V_2.GetEnumerator();
         try
         {
             while (V_9.MoveNext())
             {
                 V_10 = V_9.get_Current();
                 V_0.get_Initializer().get_Expressions().Add(V_10);
             }
         }
         finally
         {
             if (V_9 != null)
             {
                 V_9.Dispose();
             }
         }
     }
     else
     {
         V_8 = new InitializerExpression(V_2, 0);
         V_8.set_IsMultiLine(true);
         V_0.set_Initializer(V_8);
     }
     result = statements.get_Item(startIndex);
     replacedStatementsCount = V_2.get_Count() + 1;
     return(true);
 }
Exemple #20
0
 internal ICollection <ClassHierarchyNode> BuildHierarchy(HashSet <VariableReference> resolvedVariables)
 {
     V_1 = this.methodContext.get_StackData().get_VariableToDefineUseInfo().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current();
             V_3 = V_2.get_Key();
             if (resolvedVariables.Contains(V_3) || !this.ShouldConsiderVariable(V_3))
             {
                 continue;
             }
             V_4       = this.GetVariableNode(V_3);
             dummyVar0 = this.resultingGraph.Add(V_4);
             V_5       = V_2.get_Value().get_DefinedAt().GetEnumerator();
             try
             {
                 while (V_5.MoveNext())
                 {
                     V_6 = V_5.get_Current();
                     this.OnPhiVariableAssigned(V_6, V_4);
                 }
             }
             finally
             {
                 ((IDisposable)V_5).Dispose();
             }
             V_7 = V_2.get_Value().get_UsedAt().GetEnumerator();
             try
             {
                 while (V_7.MoveNext())
                 {
                     V_8 = V_7.get_Current();
                     this.OnPhiVariableUsed(V_8, V_4);
                 }
             }
             finally
             {
                 ((IDisposable)V_7).Dispose();
             }
         }
     }
     finally
     {
         ((IDisposable)V_1).Dispose();
     }
     this.RemoveImpossibleEdges();
     V_0 = new HashSet <ClassHierarchyNode>();
     V_9 = this.resultingGraph.GetEnumerator();
     try
     {
         while (V_9.MoveNext())
         {
             V_10 = V_9.get_Current();
             if (!V_10.get_IsHardNode())
             {
                 continue;
             }
             dummyVar1 = V_0.Add(V_10);
         }
     }
     finally
     {
         ((IDisposable)V_9).Dispose();
     }
     this.BuildUpHardNodesHierarchy(V_0);
     return(this.resultingGraph);
 }
Exemple #21
0
 internal static CFGBlockLogicalConstruct FindGuardedBlockCFGFollowNode(ExceptionHandlingLogicalConstruct construct, HashSet <CFGBlockLogicalConstruct> outOfconsideration)
 {
     V_0 = new Dictionary <CFGBlockLogicalConstruct, uint>();
     GuardedBlocksFollowNodesFinder.AddSuccessorsToCount(construct.get_Try(), V_0);
     V_1 = 1;
     if (construct as TryCatchFilterLogicalConstruct == null)
     {
         if (construct as TryFaultLogicalConstruct == null)
         {
             if (construct as TryFinallyLogicalConstruct != null)
             {
                 GuardedBlocksFollowNodesFinder.AddSuccessorsToCount((construct as TryFinallyLogicalConstruct).get_Finally(), V_0);
                 V_1 = V_1 + 1;
             }
         }
         else
         {
             GuardedBlocksFollowNodesFinder.AddSuccessorsToCount((construct as TryFaultLogicalConstruct).get_Fault(), V_0);
             V_1 = V_1 + 1;
         }
     }
     else
     {
         V_5 = (construct as TryCatchFilterLogicalConstruct).get_Handlers();
         V_6 = 0;
         while (V_6 < (int)V_5.Length)
         {
             GuardedBlocksFollowNodesFinder.AddSuccessorsToCount(V_5[V_6], V_0);
             V_1 = V_1 + 1;
             V_6 = V_6 + 1;
         }
     }
     V_7 = outOfconsideration.GetEnumerator();
     try
     {
         while (V_7.MoveNext())
         {
             V_8 = V_7.get_Current();
             if (!V_0.ContainsKey(V_8))
             {
                 continue;
             }
             dummyVar0 = V_0.Remove(V_8);
         }
     }
     finally
     {
         ((IDisposable)V_7).Dispose();
     }
     if (V_0.get_Count() == 0)
     {
         return(null);
     }
     V_2       = new HashSet <CFGBlockLogicalConstruct>();
     V_3       = V_0.get_Keys().FirstOrDefault <CFGBlockLogicalConstruct>();
     dummyVar1 = V_2.Add(V_3);
     V_4       = V_0.get_Item(V_3);
     V_9       = V_0.get_Keys().GetEnumerator();
     try
     {
         while (V_9.MoveNext())
         {
             V_10 = V_9.get_Current();
             if (V_0.get_Item(V_10) <= V_4)
             {
                 if (V_0.get_Item(V_10) != V_4)
                 {
                     continue;
                 }
                 dummyVar3 = V_2.Add(V_10);
             }
             else
             {
                 V_4 = V_0.get_Item(V_10);
                 V_2.Clear();
                 dummyVar2 = V_2.Add(V_10);
             }
         }
     }
     finally
     {
         ((IDisposable)V_9).Dispose();
     }
     if (V_2.get_Count() == 1)
     {
         return(V_2.FirstOrDefault <CFGBlockLogicalConstruct>());
     }
     V_11 = new HashSet <CFGBlockLogicalConstruct>();
     V_12 = 0;
     V_7  = V_2.GetEnumerator();
     try
     {
         while (V_7.MoveNext())
         {
             V_14 = V_7.get_Current();
             V_15 = 0;
             V_16 = construct.get_CFGBlocks();
             V_17 = V_14.get_CFGPredecessors().GetEnumerator();
             try
             {
                 while (V_17.MoveNext())
                 {
                     V_18 = V_17.get_Current();
                     if (!V_16.Contains(V_18))
                     {
                         continue;
                     }
                     V_15 = V_15 + 1;
                 }
             }
             finally
             {
                 ((IDisposable)V_17).Dispose();
             }
             if (V_15 < V_12)
             {
                 continue;
             }
             if (V_15 > V_12)
             {
                 V_12 = V_15;
                 V_11.Clear();
             }
             dummyVar4 = V_11.Add(V_14);
         }
     }
     finally
     {
         ((IDisposable)V_7).Dispose();
     }
     V_13 = V_11.FirstOrDefault <CFGBlockLogicalConstruct>();
     if (V_13.get_Index() < construct.get_Entry().get_Index())
     {
         V_19 = null;
         V_7  = V_11.GetEnumerator();
         try
         {
             while (V_7.MoveNext())
             {
                 V_20 = V_7.get_Current();
                 if (V_20.get_Index() <= construct.get_Entry().get_Index() || V_19 != null && V_19.get_Index() < V_20.get_Index())
                 {
                     continue;
                 }
                 V_19 = V_20;
             }
         }
         finally
         {
             ((IDisposable)V_7).Dispose();
         }
         if (V_19 != null)
         {
             V_13 = V_19;
         }
     }
     return(V_13);
 }
Exemple #22
0
		public override ICodeNode VisitBinaryExpression(BinaryExpression expression)
		{
			expression.set_Left((Expression)this.Visit(expression.get_Left()));
			expression.set_Right((Expression)this.Visit(expression.get_Right()));
			V_0 = expression.get_Left().get_ExpressionType();
			V_0 = this.GetElementType(V_0);
			if (V_0 != null)
			{
				if (String.op_Equality(V_0.get_FullName(), this.typeSystem.get_Char().get_FullName()))
				{
					if (expression.get_Right().get_CodeNodeType() == 22)
					{
						if (this.IsArithmeticOperator(expression.get_Operator()))
						{
							expression.set_ExpressionType(this.typeSystem.get_Char());
							return expression;
						}
						if (expression.get_Right().get_HasType())
						{
							V_2 = this.GetElementType(expression.get_Right().get_ExpressionType());
							if (String.op_Equality(V_0.get_FullName(), V_2.get_FullName()))
							{
								return expression;
							}
						}
						V_1 = expression.get_Right() as LiteralExpression;
						expression.set_Right(this.GetLiteralExpression((char)((Int32)V_1.get_Value()), V_1.get_MappedInstructions()));
					}
					if (String.op_Inequality(this.GetElementType(expression.get_Right().get_ExpressionType()).get_FullName(), this.typeSystem.get_Char().get_FullName()))
					{
						if (expression.get_Right().get_CodeNodeType() != 31 || !String.op_Equality(expression.get_Right().get_ExpressionType().get_FullName(), this.typeSystem.get_UInt16().get_FullName()))
						{
							expression.set_Right(new ExplicitCastExpression(expression.get_Right(), this.typeSystem.get_Char(), null));
						}
						else
						{
							((ExplicitCastExpression)expression.get_Right()).set_TargetType(this.typeSystem.get_Char());
						}
					}
				}
				if (String.op_Equality(V_0.get_FullName(), this.typeSystem.get_Boolean().get_FullName()) && expression.get_Right().get_CodeNodeType() == 22)
				{
					if (expression.get_Operator() == 9 || expression.get_Operator() == 10 || this.IsBooleanAssignmentOperator(expression.get_Operator()))
					{
						V_3 = expression.get_Right() as LiteralExpression;
						V_4 = true;
						if (V_3.get_Value() == null || V_3.get_Value().Equals(0) || V_3.get_Value().Equals(false) || V_3.get_Value().Equals(null))
						{
							V_4 = false;
						}
						expression.set_Right(this.GetLiteralExpression(V_4, V_3.get_MappedInstructions()));
					}
					if (expression.get_Operator() == 9 || expression.get_Operator() == 10)
					{
						return this.SimplifyBooleanComparison(expression);
					}
				}
			}
			if (expression.get_Operator() == 9 || expression.get_Operator() == 10)
			{
				V_5 = this.GetElementType(expression.get_Right().get_ExpressionType());
				if (V_5 != null && V_0 != null && String.op_Inequality(V_5.get_FullName(), V_0.get_FullName()))
				{
					return this.FixEqualityComparisonExpression(expression);
				}
			}
			if (expression.get_IsAssignmentExpression())
			{
				if (!this.NeedsPointerCast(expression))
				{
					if (expression.get_Left().get_HasType() && expression.get_Left().get_ExpressionType().get_IsByReference() || expression.get_Left().get_ExpressionType().get_IsPointer() || expression.get_Left().get_ExpressionType().get_IsArray() || !expression.get_Left().get_ExpressionType().get_IsPrimitive())
					{
						V_6 = expression.get_Left().get_ExpressionType().Resolve();
						if (V_6 != null && !V_6.get_IsEnum() && expression.get_Right() as LiteralExpression != null)
						{
							V_7 = expression.get_Right() as LiteralExpression;
							if (V_7.get_Value() != null && V_7.get_Value().Equals(0))
							{
								expression.set_Right(new LiteralExpression(null, this.typeSystem, expression.get_Right().get_UnderlyingSameMethodInstructions()));
							}
						}
					}
				}
				else
				{
					if (expression.get_Right().get_CodeNodeType() != 45)
					{
						expression.set_Right(new ExplicitCastExpression(expression.get_Right(), expression.get_Left().get_ExpressionType(), null));
					}
					else
					{
						expression.get_Right().set_ExpressionType(expression.get_Left().get_ExpressionType());
					}
				}
			}
			if (expression.get_Operator() == 15 && expression.get_MappedInstructions().Count<Instruction>() == 1 && expression.get_MappedInstructions().First<Instruction>().get_OpCode().get_Code() == 194)
			{
				V_9 = null;
				if (expression.get_Right().get_CodeNodeType() != 22)
				{
					if (expression.get_Right().get_CodeNodeType() == 31)
					{
						V_10 = expression.get_Right() as ExplicitCastExpression;
						if (V_10.get_Expression().get_CodeNodeType() == 22)
						{
							V_9 = V_10.get_Expression() as LiteralExpression;
						}
					}
				}
				else
				{
					V_9 = expression.get_Right() as LiteralExpression;
				}
				if (V_9 != null && V_9.get_Value() == null || V_9.get_Value().Equals(0))
				{
					expression.set_Operator(10);
				}
			}
			if (expression.get_IsObjectComparison())
			{
				V_11 = expression.get_Left();
				V_12 = expression.get_Right();
				if (this.CheckForOverloadedEqualityOperators(expression.get_Left(), out V_13) && this.CheckForOverloadedEqualityOperators(expression.get_Right(), out V_14))
				{
					expression.set_Left(new ExplicitCastExpression(V_11, V_11.get_ExpressionType().get_Module().get_TypeSystem().get_Object(), null, V_13));
					expression.set_Right(new ExplicitCastExpression(V_12, V_12.get_ExpressionType().get_Module().get_TypeSystem().get_Object(), null, V_14));
				}
			}
			return expression;
		}
Exemple #23
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;
 }
 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);
 }
 public void CleanUpUnusedDeclarations()
 {
     V_1 = this.referenceToDeclarationStatementMap.GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current();
             V_3 = V_2.get_Key();
             this.context.get_MethodContext().RemoveVariable(V_3);
             V_4 = V_2.get_Value();
             V_5 = V_4.get_Parent() as BlockStatement;
             if (!this.IsOptimisableAssignment(V_4))
             {
                 V_6 = (V_4.get_Expression() as BinaryExpression).get_Right();
                 if (!this.CanExistInStatement(V_6))
                 {
                     continue;
                 }
                 if (V_6.get_CodeNodeType() == 87)
                 {
                     V_6 = (V_6 as ParenthesesExpression).get_Expression();
                 }
                 V_7 = new ExpressionStatement(V_6);
                 V_8 = V_5.get_Statements().IndexOf(V_4);
                 V_5.AddStatementAt(V_8 + 1, V_7);
                 this.TransferLabel(V_4);
                 V_5.get_Statements().RemoveAt(V_8);
             }
             else
             {
                 this.TransferLabel(V_4);
                 dummyVar0 = V_5.get_Statements().Remove(V_4);
             }
         }
     }
     finally
     {
         ((IDisposable)V_1).Dispose();
     }
     V_0 = new HashSet <VariableDefinition>();
     V_9 = this.context.get_MethodContext().get_Variables().GetEnumerator();
     try
     {
         while (V_9.MoveNext())
         {
             V_10 = V_9.get_Current();
             if (this.bannedVariables.Contains(V_10))
             {
                 continue;
             }
             dummyVar1 = V_0.Add(V_10);
         }
     }
     finally
     {
         V_9.Dispose();
     }
     V_11 = V_0.GetEnumerator();
     try
     {
         while (V_11.MoveNext())
         {
             V_12 = V_11.get_Current();
             this.context.get_MethodContext().RemoveVariable(V_12);
         }
     }
     finally
     {
         ((IDisposable)V_11).Dispose();
     }
     return;
 }
 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;
 }