private bool TryMatchInternal(StatementCollection statements, int startIndex, out Statement result) { result = null; if (statements.get_Count() < startIndex + 2) { return(false); } if (statements.get_Item(startIndex).get_CodeNodeType() != 5 || statements.get_Item(startIndex + 1).get_CodeNodeType() != 3) { return(false); } if (!String.IsNullOrEmpty(statements.get_Item(startIndex + 1).get_Label())) { return(false); } V_3 = (statements.get_Item(startIndex) as ExpressionStatement).get_Expression() as BinaryExpression; if (!this.IsAssignToVariableExpression(V_3, out V_0)) { return(false); } V_1 = V_3.get_Right(); V_4 = statements.get_Item(startIndex + 1) as IfStatement; if (this.ContainsDummyAssignment(V_4.get_Then(), V_0)) { stackVariable50 = 1; } else { stackVariable50 = 0; } V_5 = stackVariable50; if (V_4.get_Else() != null || V_4.get_Then().get_Statements().get_Count() != 1 + V_5 || V_4.get_Then().get_Statements().get_Item(V_5).get_CodeNodeType() != 5 || !String.IsNullOrEmpty(V_4.get_Then().get_Statements().get_Item(V_5).get_Label())) { return(false); } V_6 = V_4.get_Condition() as BinaryExpression; if (V_6 == null || V_6.get_Operator() != 9 || V_6.get_Left().get_CodeNodeType() != 26 || (object)(V_6.get_Left() as VariableReferenceExpression).get_Variable() != (object)V_0 || V_6.get_Right().get_CodeNodeType() != 22 || (V_6.get_Right() as LiteralExpression).get_Value() != null) { return(false); } V_7 = (V_4.get_Then().get_Statements().get_Item(V_5) as ExpressionStatement).get_Expression() as BinaryExpression; if (V_7 == null || !this.IsAssignToVariableExpression(V_7, out V_8) || (object)V_8 != (object)V_0) { return(false); } V_2 = V_7.get_Right(); if (!V_1.get_HasType() || !V_2.get_HasType() || String.op_Inequality(V_1.get_ExpressionType().get_FullName(), V_2.get_ExpressionType().get_FullName())) { return(false); } V_9 = new BinaryExpression(27, V_1, V_2, this.typeSystem, null, false); V_10 = new BinaryExpression(26, new VariableReferenceExpression(V_0, null), V_9, this.typeSystem, null, false); stackVariable150 = new ExpressionStatement(V_10); stackVariable150.set_Parent(statements.get_Item(startIndex).get_Parent()); result = stackVariable150; this.FixContext(V_0.Resolve(), 1, V_5 + 1, result as ExpressionStatement); return(true); }
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; }