private void GenerateStackData() { V_0 = new StackUsageData(); V_1 = this.instructionOffsetToUsedInstructionsMap.GetEnumerator(); try { while (V_1.MoveNext()) { V_2 = V_1.get_Current(); V_3 = new List<VariableDefinition>(V_2.get_Value().Select<int, VariableDefinition>(new Func<int, VariableDefinition>(this.u003cGenerateStackDatau003eb__25_0))); V_0.get_InstructionOffsetToUsedStackVariablesMap().set_Item(V_2.get_Key(), V_3); V_4 = V_3.GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); this.GetDefineUseInfo(V_0, V_5).get_UsedAt().Add(V_2.get_Key()); } } finally { ((IDisposable)V_4).Dispose(); } } } finally { ((IDisposable)V_1).Dispose(); } V_6 = this.instructionOffsetToVariableDefinitionMap.GetEnumerator(); try { while (V_6.MoveNext()) { V_7 = V_6.get_Current(); if (V_7.get_Key() >= 0) { V_0.get_InstructionOffsetToAssignedVariableMap().Add(V_7.get_Key(), V_7.get_Value()); dummyVar0 = this.GetDefineUseInfo(V_0, V_7.get_Value()).get_DefinedAt().Add(V_7.get_Key()); } else { V_0.get_ExceptionHandlerStartToExceptionVariableMap().Add(-V_7.get_Key(), V_7.get_Value()); } } } finally { ((IDisposable)V_6).Dispose(); } this.methodContext.set_StackData(V_0); return; }
private void WriteCustomAttributeFields(CustomAttribute attribute) { V_0 = attribute.get_Fields().GetEnumerator(); try { while (V_0.MoveNext()) { V_1 = new IntermediateLanguageAttributeWriter.u003cu003ec__DisplayClass19_0(); V_1.field = V_0.get_Current(); this.WriteKeyword("field"); this.WriteSpace(); V_7 = V_1.field.get_Argument(); V_2 = V_7.get_Type().Resolve(); if (V_1.field.get_Argument().get_Type().get_IsPrimitive() || String.op_Equality(V_1.field.get_Argument().get_Type().get_FullName(), "System.String")) { V_3 = 3; } else { V_3 = 2; } V_7 = V_1.field.get_Argument(); V_4 = V_7.get_Type(); if (V_2 == null) { V_7 = V_1.field.get_Argument(); stackVariable39 = V_7.get_Type().GetFriendlyFullName(this.get_Language()); V_7 = V_1.field.get_Argument(); this.WriteNotResolvedReference(stackVariable39, V_7.get_Type(), "Enum keyword might be missing. Please, locate the assembly where the type is defined."); } else { if (!V_2.get_IsEnum()) { V_7 = V_1.field.get_Argument(); this.WriteType(V_7.get_Type(), V_3); } else { V_4 = this.GetEnumerationUnderlayingType(V_2); this.WriteKeyword("enum"); this.WriteSpace(); V_7 = V_1.field.get_Argument(); this.WriteType(V_7.get_Type(), V_3); V_3 = 3; } } this.WriteSpace(); V_5 = null; V_6 = attribute.get_AttributeType().Resolve(); if (V_6 != null) { V_5 = V_6.get_Fields().First <FieldDefinition>(new Func <FieldDefinition, bool>(V_1.u003cWriteCustomAttributeFieldsu003eb__0)); } this.WriteReference(V_1.field.get_Name(), V_5); this.WriteSpace(); this.Write("="); this.WriteSpace(); this.WriteType(V_4, V_3); this.Write("("); V_7 = V_1.field.get_Argument(); this.Write(V_7.get_Value().ToString()); this.Write(")"); this.WriteLine(); } } finally { V_0.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; }
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; }