protected override bool ProcessCFG() { StateMachineDisposeAnalyzer disposeAnalyzer = new StateMachineDisposeAnalyzer(moveNextMethodContext.Method); StateControllerRemover controllerRemover; YieldStateMachineVersion machineVersion = disposeAnalyzer.ProcessDisposeMethod(); if (machineVersion == YieldStateMachineVersion.V1) { controllerRemover = new StateControllerRemover(moveNextMethodContext); } else if (machineVersion == YieldStateMachineVersion.V2) { controllerRemover = new DisposingStateControllerRemover(moveNextMethodContext, disposeAnalyzer.StateField, disposeAnalyzer.DisposingField); StateMachineDoFinallyCheckRemover doFinallyCheckRemover = new StateMachineDoFinallyCheckRemover(moveNextMethodContext); if (!doFinallyCheckRemover.MarkFinallyConditionsForRemoval()) { return(false); } toBeRemoved.UnionWith(doFinallyCheckRemover.BlocksMarkedForRemoval); } else { return(false); } if (!controllerRemover.RemoveStateMachineController()) { return(false); } toBeRemoved.UnionWith(controllerRemover.BlocksMarkedForRemoval); SwitchData switchData = controllerRemover.SwitchData; YieldStateMachineControlFlowRebuilder controlFlowRebuilder = new YieldStateMachineControlFlowRebuilder(moveNextMethodContext, switchData, controllerRemover.StateField); if (!controlFlowRebuilder.ProcessEndBlocks()) { return(false); } toBeRemoved.UnionWith(controlFlowRebuilder.BlocksMarkedForRemoval); StateMachineCFGCleaner cfgCleaner = new StateMachineCFGCleaner(theCFG, switchData, switchData.OrderedCasesArray[0]); if (!cfgCleaner.CleanUpTheCFG(toBeRemoved)) { return(false); } YieldFieldsInformation fieldsInfo = new YieldFieldsInformation(controllerRemover.StateField, controlFlowRebuilder.CurrentItemField, controlFlowRebuilder.ReturnFlagVariable); this.moveNextMethodContext.YieldData = new YieldData(machineVersion, controlFlowRebuilder.YieldReturnBlocks, controlFlowRebuilder.YieldBreakBlocks, fieldsInfo, disposeAnalyzer.YieldsExceptionData); return(true); }
protected override bool ProcessCFG() { V_0 = new StateMachineDisposeAnalyzer(this.moveNextMethodContext.get_Method()); V_2 = V_0.ProcessDisposeMethod(); if (V_2 != 1) { if (V_2 != 2) { return(false); } V_1 = new DisposingStateControllerRemover(this.moveNextMethodContext, V_0.get_StateField(), V_0.get_DisposingField()); V_6 = new StateMachineDoFinallyCheckRemover(this.moveNextMethodContext); if (!V_6.MarkFinallyConditionsForRemoval()) { return(false); } this.toBeRemoved.UnionWith(V_6.get_BlocksMarkedForRemoval()); } else { V_1 = new StateControllerRemover(this.moveNextMethodContext, null); } if (!V_1.RemoveStateMachineController()) { return(false); } this.toBeRemoved.UnionWith(V_1.get_BlocksMarkedForRemoval()); V_3 = V_1.get_SwitchData(); V_4 = new YieldStateMachineControlFlowRebuilder(this.moveNextMethodContext, V_3, V_1.get_StateField()); if (!V_4.ProcessEndBlocks()) { return(false); } this.toBeRemoved.UnionWith(V_4.get_BlocksMarkedForRemoval()); if (!(new StateMachineCFGCleaner(this.theCFG, V_3, V_3.get_OrderedCasesArray()[0])).CleanUpTheCFG(this.toBeRemoved)) { return(false); } V_5 = new YieldFieldsInformation(V_1.get_StateField(), V_4.get_CurrentItemField(), V_4.get_ReturnFlagVariable()); this.moveNextMethodContext.set_YieldData(new YieldData(V_2, V_4.get_YieldReturnBlocks(), V_4.get_YieldBreakBlocks(), V_5, V_0.get_YieldsExceptionData())); return(true); }