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; }
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; }
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; }