public static void insertReturnExpectation(CodeLine currentLine, int lineNumber, Logic targetLogic) { if (currentLine.returnCalculations == null) { currentLine.returnCalculations = (Logic[])currentLine.logicOrder.Clone(); } Logic[] tempOrder = (Logic[])currentLine.getLatestOrder(); searchInLogicOrderExpect(tempOrder, lineNumber, targetLogic); }
private static bool insertReturnValueIntoPackageExpect(Package thePackage, int lineNumber, Logic targetLogic) { if (thePackage.returnCalculations == null) { thePackage.returnCalculations = (Logic[])thePackage.logicOrder.Clone(); } Logic[] tempOrder = thePackage.getLatestOrder(); return(searchInLogicOrderExpect(tempOrder, lineNumber, targetLogic)); }
private static bool insertReturnValueIntoFuncCallExpect(FunctionCall theFuncCall, int lineNumber, Logic targetLogic) { if (theFuncCall.returnCalculations == null) { return(false); } foreach (Logic[] l in theFuncCall.returnCalculations) { if (searchInLogicOrderExpect(l, lineNumber, targetLogic)) { return(true); } } return(false); }
private static bool searchInLogicOrderExpect(Logic[] logicOrder, int lineNumber, Logic targetLogic) { for (int i = 0; i < logicOrder.Length; i++) { if (logicOrder [i] == targetLogic) { logicOrder [i] = new ReturnValue(); return(true); } else if (logicOrder [i].currentType == WordTypes.package) { if (insertReturnValueIntoPackageExpect(logicOrder[i] as Package, lineNumber, targetLogic)) { return(true); } } else if (logicOrder [i].currentType == WordTypes.functionCall) { if (insertReturnValueIntoFuncCallExpect(logicOrder[i] as FunctionCall, lineNumber, targetLogic)) { return(true); } } } return(false); }